Skip to content

Merge pull request #1325 from danskernesdigitalebibliotek/develop #40

Merge pull request #1325 from danskernesdigitalebibliotek/develop

Merge pull request #1325 from danskernesdigitalebibliotek/develop #40

name: Create release on tag
on:
push:
tags:
- "*"
jobs:
create_release_on_tag:
name: "Create release on tag"
runs-on: ubuntu-latest
steps:
- name: Set release variables
id: resolve-release-vars
run: |
RELEASE_NAME=${{ github.ref_name }}
RELEASE_NAME_SLUGGED=$(echo $RELEASE_NAME | sed -E -e 's/[^[:alnum:]]+/-/g' -e 's/^-+|-+$//g' | tr '[:upper:]' '[:lower:]')
RELEASE_SHA=${{ github.sha }}
echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV"
echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV"
echo "BUILD_VERSION=${RELEASE_NAME}-${RELEASE_SHA}" >> "$GITHUB_ENV"
echo "DIST_FILENAME=dist-${RELEASE_NAME_SLUGGED}-${RELEASE_SHA}.zip" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build artifacts
run: yarn build
env:
VERSION_FILE_NAME: ${{ github.repository }}
VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }}
- name: Zip project
run: |
zip -r -j ${{ env.DIST_FILENAME }} dist/
- name: Create release
id: create-release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.DIST_FILENAME }}
- name: Adding summary
run: |
echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY