Skip to content

release: fix sourcode code upload label #32

release: fix sourcode code upload label

release: fix sourcode code upload label #32

Workflow file for this run

# trunk-ignore-all(yamllint/quoted-strings)
# trunk-ignore-all(checkov/CKV_GHA_7)
name: Release
permissions:
contents: write
on:
push:
tags:
- v*.*.*
workflow_dispatch:
inputs:
ref_name:
description: ref_name
required: true
type: string
env:
GH_TAG: ${{ github.ref_name || inputs.ref_name }}
ASSET_BASENAME: "amalgamate-${{ github.ref_name || inputs.ref_name }}"
jobs:
draft:
runs-on: ubuntu-latest
steps:
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: >
gh release create "${GH_TAG}"
--title "amalgamate ${GH_TAG}"
--draft
--generate-notes
--verify-tag
source_code:
needs: [ draft ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
submodules: true
- name: Create assets
run: bash .github/source-code.sh pack
- name: Upload assets
run: bash .github/source-code.sh upload
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
binaries:
needs: [ draft ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, macos-latest, ]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@main
with:
submodules: true
- id: setup
shell: python
run: |
from os import getenv
from platform import machine, system
from pathlib import Path
basename = f"{getenv('ASSET_BASENAME')}-{system().lower()}-{machine().lower()}"
output_path = Path(getenv('GITHUB_OUTPUT')).write_text(f"basename={basename}\n")
- run: pipx install -- meson ninja
- run: meson setup --reconfigure --buildtype=release -- build
- run: meson compile --jobs 4 --verbose -C build
- run: meson install --destdir "${BASENAME}" -C build
env: { BASENAME: "${{ steps.setup.outputs.basename }}", }
- run: zip -r "${BASENAME}.zip" "build/${BASENAME}"
env: { BASENAME: "${{ steps.setup.outputs.basename }}", }
- run: gh release upload --clobber "${GH_TAG}" "${BASENAME}.zip"
env:
BASENAME: "${{ steps.setup.outputs.basename }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
windows:
needs: [ draft ]
if: false
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with: { submodules: true }
- uses: ilammy/msvc-dev-cmd@v1
- name: Initialize environment
run: Add-Content "${GITHUB_ENV}" "ARCHIVE_PATH=${ASSET_BASENAME}-windows-amd64.zip"
- name: Build
run: ./build.bat
- name: Create assets
run: Compress-Archive -verbose -Path "amalgamate.exe", "README.md", "LICENSE" -DestinationPath "${ARCHIVE_PATH}"
- name: Upload assets
env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" }
run: gh release upload --clobber "${GH_TAG}" "${ARCHIVE_PATH}"
finish:
needs: [ source_code, binaries ]
if: false
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
AUTOGEN_RELNOTES_PATH: "${{ github.workspace }}/autogen-release-notes.md"
RELNOTES_PATH: "${{ github.workspace }}/relnotes.md"
ASSETS_DIR_PATH: "${{ github.workspace }}/assets"
CHECKSUM_PATH: "${{ github.workspace }}/${ASSET_BASENAME}-sha256sum.txt"
steps:
- name: "Download automatically generated release notes"
run: gh release view --json body --jq .body "${GH_TAG}" > "${AUTOGEN_RELNOTES_PATH}"
- name: "Download assets"
run: gh release download --dir "${ASSETS_DIR_PATH}" "${GH_TAG}"
- name: "Generate checksum file"
run: |
set -evx
cd "${ASSETS_DIR_PATH}"
sha256sum * > "${CHECKSUM_PATH}"
- name: "Upload checksum file"
run: gh release upload --clobber "${GH_TAG}" "${CHECKSUM_PATH}"
- name: "Relnotes: init"
run: |
set -evx
br(){ echo "" >> "${RELNOTES_PATH}";}
- name: "Relnotes: append auto notes"
run: cat "${AUTOGEN_RELNOTES_PATH}" >> "${RELNOTES_PATH}"
- name: "Relnotes: checksum section"
run: |
wget "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.github/relnotes-checksum-md.sh"
. "relnotes-checksum-md.sh" >> "${RELNOTES_PATH}"
- name: "Finish release"
run: gh release edit --draft=false --notes-file "${RELNOTES_PATH}" "${GH_TAG}"