cuelang.org/go@v0.10.1/internal/_e2e/testdata/script/github_app_public.txtar (about)

     1  # Publish a CUE module under a public GitHub repository namespace
     2  # where the $CUE_TEST_LOGINS tokens have full read-write access.
     3  # Publish a version for this new repository with `cue mod publish`,
     4  # and then fetch the module as a dependency via cmd/cue.
     5  
     6  github-repo-module public
     7  env VERSION=v0.0.1
     8  env MODVER=${MODULE}@v0
     9  
    10  cd publish
    11  
    12  exec cue mod init --source self ${MODVER}
    13  exec cue mod publish ${VERSION}
    14  
    15  cd ../depend
    16  
    17  env-fill out_foo.cue
    18  exec cue mod init --source self depend.localhost
    19  exec cue mod tidy
    20  exec cue export
    21  cmp stdout export.golden
    22  
    23  # TODO(mvdan): Use another registry token without access to this private repo
    24  # and check that they can list and fetch, but not publish, any versions.
    25  
    26  # Trying to publish the same version again with the same contents should succeed.
    27  cd ../publish
    28  exec cue mod publish ${VERSION}
    29  
    30  # Trying to publish the same version again with different contents should fail.
    31  # TODO: Note that the error does say the repository has enabled tag immutability,
    32  # but that error message comes from Google Cloud, not from our registry service,
    33  # so it's not a stable string. We should give the user a short and stable error,
    34  # and test for it here with a regular expression.
    35  cd ../publish-different
    36  exec cue mod init --source self ${MODVER}
    37  ! exec cue mod publish ${VERSION}
    38  stderr 'cannot tag.*400 Bad Request'
    39  
    40  -- publish/foo.cue --
    41  package publish
    42  
    43  foo: "foo value"
    44  
    45  -- publish-different/foo.cue --
    46  package publish
    47  
    48  foo: "different foo value"
    49  
    50  -- depend/out_foo.cue --
    51  package depend
    52  
    53  import mt "${MODVER}:publish"
    54  
    55  out: mt.foo
    56  -- depend/export.golden --
    57  {
    58      "out": "foo value"
    59  }