feat: create a github action to create a bcr entry #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: action-e2e | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| # Cancel previous actions from the same PR or branch except 'main' branch. | |
| # See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. | |
| group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} | |
| cancel-in-progress: ${{ github.ref_name != 'main' }} | |
| jobs: | |
| test-github-repository-default: | |
| # Test that the `github-repository` input defaults to ${{ github.repository }} | |
| # indirectly by checking the substituted source.json file. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| path: this | |
| - name: Setup test fixture | |
| run: | | |
| set -o errexit -o nounset -o pipefail | |
| tar -czvf archive.tar.gz -C this/e2e/fixtures/versioned --transform 's,^./,versioned-1.0.0/,' . | |
| cat this/e2e/fixtures/versioned/.bcr/source.template.json | jq ".url = \"file://$(realpath archive.tar.gz)\"" > "/tmp/source.template.json" | |
| mv /tmp/source.template.json this/e2e/fixtures/versioned/.bcr/source.template.json | |
| - name: Create registry | |
| run: | | |
| mkdir -p bazel-central-registry/modules | |
| cd bazel-central-registry | |
| git init | |
| - name: Create entry | |
| uses: ./this | |
| with: | |
| tag: v1.0.0 | |
| module-version: 1.0.0 | |
| templates-dir: this/e2e/fixtures/versioned/.bcr | |
| local-registry: bazel-central-registry |