Skip to content

Commit

Permalink
Skip release creation on rc tag (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Jul 5, 2023
1 parent 12d8dc9 commit a5b6a82
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,13 @@ jobs:
with:
name: ${{ env.PKGBUILD }}

- name: Check if release exists
id: check-if-release-exists
uses: insightsengineering/release-existence-action@v1

- name: Upload binaries to release 🔼
if: >-
steps.check-if-release-exists.outputs.release-exists == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ jobs:
with:
name: pkgdown.zip

- name: Check if release exists
id: check-if-release-exists
uses: insightsengineering/release-existence-action@v1

- name: Upload binaries to release ⤴
if: >-
steps.check-if-release-exists.outputs.release-exists == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ on:
description: |
Github token with write access to the repository
required: false
inputs:
create-rc-releases:
description: Whether releases for RC tags (e.g. v0.0.1-rc1) should be created?
required: false
default: false
type: boolean
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -40,13 +46,33 @@ jobs:
- name: Checkout repo 🛎
uses: actions/checkout@v3

- name: Get branch names 🌿
id: branch-name
uses: tj-actions/branch-names@v6

- name: Check if running for rc tag 🏷️
id: rc-tag
run: |
echo "Current tag: ${{ steps.branch-name.outputs.tag }}"
current_tag="${{ steps.branch-name.outputs.tag }}"
if [ "$(echo "$current_tag" | grep -E "^v([0-9]+\.)?([0-9]+\.)?([0-9]+)(-rc[0-9]+)$")" != "" ]; then
echo "Running for rc-tag."
echo "is-rc-tag=true" >> $GITHUB_OUTPUT
else
echo "is-rc-tag=false" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Generate Changelog 📜
run: |
RELEASE_VERSION=$(awk -F: '/Version:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION)
REPOSITORY_NAME="${{ github.event.repository.name }}"
(awk "/^#+.*${REPOSITORY_NAME//./\.}.*${RELEASE_VERSION//./\.}$/{flag=1;next}/^#+.*${REPOSITORY_NAME//./\.}.*/{flag=0}flag" NEWS.md | grep -v "^$" || echo "* ${RELEASE_VERSION}") > RELEASE_BODY.txt
- name: Create release 🌟
if: >-
steps.rc-tag.outputs.is-rc-tag == 'false' ||
inputs.create-rc-releases == true
uses: softprops/action-gh-release@v1
with:
body_path: RELEASE_BODY.txt
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,21 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout repo 🛎
uses: actions/checkout@v3

- name: Download artifact ⏬
uses: actions/download-artifact@v3
with:
name: validation_report.pdf

- name: Check if release exists
id: check-if-release-exists
uses: insightsengineering/release-existence-action@v1

- name: Upload report to release 🔼
if: >-
steps.check-if-release-exists.outputs.release-exists == 'true'
uses: svenstaro/upload-release-action@v2
with:
file: ./validation_report.pdf
Expand Down

0 comments on commit a5b6a82

Please sign in to comment.