ci: use env NEXT_RELEASE_VERSION in the pipeline #40
This file contains 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: rules-pact | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test_job: | |
runs-on: ubuntu-20.04 | |
container: | |
image: gcr.io/bazel-public/bazel:6.3.2 | |
volumes: | |
- /usr/bin/docker:/usr/bin/docker | |
- /var/run/docker.sock:/var/run/docker.sock | |
options: -e USER="root" -u="root" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/cache | |
key: bazel-cache | |
restore-keys: | | |
bazel-cache | |
- name: Bazel test | |
run: bazel --output_user_root=/tmp/cache test --test_output=errors //... | |
release_job: | |
runs-on: ubuntu-20.04 | |
needs: test_job | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
extra_plugins: | | |
@semantic-release/[email protected] | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Do something when a new release published | |
if: steps.semantic.outputs.new_release_published == 'true' | |
env: | |
NEXT_RELEASE_VERSION: ${{ steps.semantic.outputs.new_release_version }} | |
run: | | |
echo $NEXT_RELEASE_VERSION | |
- name: FETCH THE SOURCE ARCHIVE | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: | | |
curl \ | |
-L \ | |
-o rules_pact-v$NEXT_RELEASE_VERSION.tar.gz \ | |
https://github.com/opicaud/rules_pact/archive/refs/tags/v$NEXT_RELEASE_VERSION.tar.gz | |
- name: CREATE RELEASE | |
if: steps.semantic.outputs.new_release_published == 'true' | |
id: create-release | |
uses: ncipollo/[email protected] | |
with: | |
name: rules_pact v$NEXT_RELEASE_VERSION | |
tag: v$NEXT_RELEASE_VERSION | |
allowUpdates: true | |
draft: true | |
artifactErrorsFailBuild: true | |
updateOnlyUnreleased: true | |
generateReleaseNotes: false | |
artifacts: >- | |
rules_pact-v$NEXT_RELEASE_VERSION.tar.gz |