|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - v3.* |
| 6 | +jobs: |
| 7 | + release: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + env: |
| 10 | + BAZEL_OTP_NAME: 25 |
| 11 | + steps: |
| 12 | + - name: CHECKOUT |
| 13 | + uses: actions/checkout@v3 |
| 14 | + - name: ASSERT VERSION |
| 15 | + id: versions |
| 16 | + env: |
| 17 | + REF_NAME: ${{ github.ref_name }} |
| 18 | + run: | |
| 19 | + sudo npm install --global --silent @bazel/buildozer |
| 20 | +
|
| 21 | + plugin_version="$(cat MODULE.bazel | buildozer 'print version' -:%module)" |
| 22 | + echo "plugin_version=${plugin_version}" | tee -a $GITHUB_OUTPUT |
| 23 | +
|
| 24 | + tag_version="${REF_NAME#v}" |
| 25 | +
|
| 26 | + if [[ "${tag_version}" != "${plugin_version}" ]]; then |
| 27 | + echo "Plugin version ${plugin_version} does not match tag ${REF_NAME}" |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | +
|
| 31 | + rmq_urls="$(cat MODULE.bazel | buildozer 'print urls' -:%archive_override)" |
| 32 | + echo "rmq_urls=${rmq_urls}" | tee -a $GITHUB_OUTPUT |
| 33 | + - name: MOUNT BAZEL CACHE |
| 34 | + uses: actions/cache@v3.3.1 |
| 35 | + with: |
| 36 | + path: "/home/runner/repo-cache/" |
| 37 | + key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE.bazel') }} |
| 38 | + restore-keys: | |
| 39 | + ${{ runner.os }}-repo-cache- |
| 40 | + - name: CONFIGURE BAZEL |
| 41 | + run: | |
| 42 | + if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then |
| 43 | + cat << EOF >> user.bazelrc |
| 44 | + build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }} |
| 45 | + EOF |
| 46 | + fi |
| 47 | + cat << EOF >> user.bazelrc |
| 48 | + build:buildbuddy --build_metadata=ROLE=CI |
| 49 | + build:buildbuddy --build_metadata=VISIBILITY=PUBLIC |
| 50 | + build:buildbuddy --repository_cache=/home/runner/repo-cache/ |
| 51 | + build:buildbuddy --color=yes |
| 52 | + build:buildbuddy --disk_cache= |
| 53 | + EOF |
| 54 | +
|
| 55 | + bazelisk info release |
| 56 | + - name: TEST |
| 57 | + run: | |
| 58 | + bazelisk test //... \ |
| 59 | + --config=rbe-${BAZEL_OTP_NAME} \ |
| 60 | + --verbose_failures |
| 61 | + - name: BUILD EZ |
| 62 | + run: | |
| 63 | + bazelisk build :ez \ |
| 64 | + --config=rbe-${BAZEL_OTP_NAME} \ |
| 65 | + --verbose_failures |
| 66 | + - name: RENAME ARTIFACT |
| 67 | + id: artifact |
| 68 | + run: | |
| 69 | + path="rabbitmq_rtopic_exchange-${{ steps.versions.outputs.plugin_version }}.ez" |
| 70 | + echo "path=${path}" | tee -a $GITHUB_OUTPUT |
| 71 | + cp bazel-bin/rabbitmq_rtopic_exchange.ez ${path} |
| 72 | + - name: UPLOAD EZ |
| 73 | + uses: actions/upload-artifact@v3.1.2 |
| 74 | + with: |
| 75 | + name: ${{ steps.artifact.outputs.path }} |
| 76 | + path: ${{ steps.artifact.outputs.path }} |
| 77 | + if-no-files-found: error |
| 78 | + - name: CREATE RELEASE |
| 79 | + id: create-release |
| 80 | + uses: ncipollo/release-action@v1.12.0 |
| 81 | + with: |
| 82 | + allowUpdates: true |
| 83 | + draft: true |
| 84 | + artifactErrorsFailBuild: true |
| 85 | + updateOnlyUnreleased: true |
| 86 | + artifacts: ${{ steps.artifact.outputs.path }} |
| 87 | + body: | |
| 88 | + rabbitmq_rtopic_exchange ${{ github.ref_name }} |
| 89 | +
|
| 90 | + Built against rabbitmq-server ${{ steps.versions.outputs.rmq_urls }} |
0 commit comments