Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

main release run 🚀 #9

main release run 🚀

main release run 🚀 #9

Workflow file for this run

# only run this workflow on the main branch and when a tag is pushed
# this workflow will create a release draft and upload the build artifacts
# to the release draft
name: Release
run-name: ${{ github.ref_name }} release run 🚀
on:
push:
branches:
- main
tags:
- '*'
permissions:
contents: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: ${{ github.ref_type == 'tag' }}
jobs:
build-project:
name: Build Project 🧱
uses: ./.github/workflows/build.yaml
secrets: inherit
permissions:
contents: read
create-release:
name: Create Release 🛫
if: github.ref_type == 'tag'
runs-on: ubuntu-22.04
needs: build-project
defaults:
run:
shell: bash
steps:
- name: Check Release Tag ☑️
id: check
run: |
: Check Release Tag ☑️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
case "${GITHUB_REF_NAME}" in
+([0-9]).+([0-9]).+([0-9]) )
echo 'validTag=true' >> $GITHUB_OUTPUT
echo 'prerelease=false' >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
;;
+([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
echo 'validTag=true' >> $GITHUB_OUTPUT
echo 'prerelease=true' >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
;;
*) echo 'validTag=false' >> $GITHUB_OUTPUT ;;
esac
- name: Download Build Artifacts 📥
uses: actions/download-artifact@v4
if: fromJSON(steps.check.outputs.validTag)
id: download
- name: Print downloaded artifacts 📥
if: fromJSON(steps.check.outputs.validTag)
run: |
: Print downloaded artifacts 📥
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
ls -laR ${{ steps.download.outputs.artifacts }}
- name: Rename Files 🏷️
if: fromJSON(steps.check.outputs.validTag)
run: |
: Rename Files 🏷️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
shopt -s nullglob
root_dir="$(pwd)"
commit_hash="${GITHUB_SHA:0:9}"
variants=(
'linux'
'macos-x86'
'windows'
)
mkdir -p "${root_dir}/uploads"
for variant in "${variants[@]}"; do
candidates=(*-${variant}/@(*))
for candidate in "${candidates[@]}"; do
cp "${candidate}" "${root_dir}/uploads/lexisynth-${variant}-${GITHUB_REF_NAME}-${commit_hash}.${candidate##*.}"
done
done
- name: Create Latest Release Info File
if: fromJSON(steps.check.outputs.validTag)
run: |
echo "LATEST_RELEASE_TAG=${GITHUB_REF_NAME}" > release_info.env
echo "LATEST_COMMIT_HASH=${GITHUB_SHA}" >> release_info.env
echo "LATEST_RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> release_info.env
cp release_info.env "$(pwd)/uploads/lexisynth_release_info.env"
- name: Generate Checksums 🪪
if: fromJSON(steps.check.outputs.validTag)
run: |
: Generate Checksums 🪪
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
# find the files from the above step and generate checksums
for file in ${{ github.workspace }}/uploads/lexisynth-*; do
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
done
- name: Create Release 🛫
if: fromJSON(steps.check.outputs.validTag)
id: create_release
uses: softprops/action-gh-release@v1
with:
draft: true
body_path: ${{ github.workspace }}/CHECKSUMS.txt
files: |
${{ github.workspace }}/uploads/lexisynth-*.dmg
${{ github.workspace }}/uploads/lexisynth-*.tar
${{ github.workspace }}/uploads/lexisynth-*.zip