master push run π #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push to master | |
run-name: ${{ github.ref_name }} push run π | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- 'release/**' | |
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-project.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 | |
echo 'validTag=true' >> $GITHUB_OUTPUT | |
echo 'prerelease=false' >> $GITHUB_OUTPUT | |
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
- name: Download Build Artifacts π₯ | |
uses: actions/download-artifact@v4 | |
if: fromJSON(steps.check.outputs.validTag) | |
id: download | |
- 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=( | |
'windows-x64;zip|exe' | |
'macos-universal;tar.xz|pkg' | |
'ubuntu-22.04-x86_64;tar.xz|deb|ddeb' | |
'sources;tar.xz' | |
) | |
for variant_data in "${variants[@]}"; do | |
IFS=';' read -r variant suffix <<< "${variant_data}" | |
candidates=(*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix})) | |
for candidate in "${candidates[@]}"; do | |
mv "${candidate}" "${root_dir}" | |
done | |
done | |
- 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 | |
for file in ${{ github.workspace }}/@(*.exe|*.deb|*.ddeb|*.pkg|*.tar.xz|*.zip); 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@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 | |
with: | |
draft: true | |
prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }} | |
tag_name: ${{ steps.check.outputs.version }} | |
name: ${{ needs.build-project.outputs.pluginName }} ${{ steps.check.outputs.version }} | |
body_path: ${{ github.workspace }}/CHECKSUMS.txt | |
files: | | |
${{ github.workspace }}/*.exe | |
${{ github.workspace }}/*.zip | |
${{ github.workspace }}/*.pkg | |
${{ github.workspace }}/*.deb | |
${{ github.workspace }}/*.ddeb | |
${{ github.workspace }}/*.tar.xz |