Skip to content

Commit

Permalink
Add workflow to automate new UI bundle releases (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlr authored Jan 26, 2024
1 parent 9706f6e commit daa7721
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/release-ui-bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Release UI Bundle

on:
push:
branches:
- 'main'

jobs:
bundle-release:
runs-on: ubuntu-latest

steps:
- name: Configure Git Credentials
uses: de-vri-es/setup-git-credentials@v2
with:
credentials: ${{ secrets.GIT_CREDENTIALS }}

- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch tags too

- name: Check Last Commit Message
id: skip_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
last_commit_message=$(git log -1 --pretty=%B)
if [[ $last_commit_message == *"[no-release]"* ]]; then
echo "Last commit message contains [no-release]. Skipping workflow."
echo "skip_release=1" >> $GITHUB_OUTPUT
fi
- name: Setup Node.js
if: ${{ steps.skip_release.outputs.skip_release == '' }}
uses: actions/setup-node@v4
with:
node-version: 21.6.1

- name: Install Dependencies
if: ${{ steps.skip_release.outputs.skip_release == '' }}
run: npm ci

- name: Build UI Bundle
if: ${{ steps.skip_release.outputs.skip_release == '' }}
run: |
set -o pipefail
gulp bundle |& tee $GITHUB_WORKSPACE/build.log
- name: Get Latest Release Tag
id: get_latest_tag
if: ${{ steps.skip_release.outputs.skip_release == '' }}
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "tag=$latest_tag" >> $GITHUB_OUTPUT
- name: Extract Tag Integer
id: extract_tag_integer
if: ${{ steps.skip_release.outputs.skip_release == '' }}
run: |
parsed_tag=${{ steps.get_latest_tag.outputs.tag }}
tag_integer=$(echo $parsed_tag | grep -oE '[0-9]+')
echo "tag_integer=$tag_integer" >> $GITHUB_OUTPUT
- name: Increment Tag
id: increment_tag
if: ${{ steps.skip_release.outputs.skip_release == '' }}
run: |
current_tag_integer=${{ steps.extract_tag_integer.outputs.tag_integer }}
next_tag_integer=$((current_tag_integer + 1))
next_tag="prod-$next_tag_integer"
echo "next_tag=$next_tag" >> $GITHUB_OUTPUT
- name: Create Release
if: ${{ steps.skip_release.outputs.skip_release == '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.increment_tag.outputs.next_tag }}
run: |
gh release create "$tag" build/ui-bundle.zip \
--repo="$GITHUB_REPOSITORY" \
--title=$tag \
--generate-notes

0 comments on commit daa7721

Please sign in to comment.