Re-release Assets #18
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
#### Re-release Assets #### | |
# This workflow exists solely to replace the zip files on existing releases, and should only be run manually. | |
# It updates all of the releases in the given range. | |
name: Re-release Assets | |
on: | |
workflow_dispatch: | |
inputs: | |
oldest: | |
description: 'Oldest release to include' # ${{ github.event.inputs.oldest }} | |
required: true | |
default: 'v1.2.3' | |
newest: | |
description: 'Newest release to include' | |
required: true | |
default: 'v1.2.4' | |
jobs: | |
release_assets_by_tag: | |
name: release-assets | |
runs-on: ${{ matrix.os }} | |
permissions: | |
actions: write | |
contents: write | |
deployments: write | |
packages: write | |
pull-requests: write | |
security-events: write | |
statuses: write | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
zip_command_debug: zip --quiet -r CoseSignTool-Windows-debug.zip ./published/debug/ | |
zip_command_release: zip --quiet -r CoseSignTool-Windows-release.zip ./published/release/ | |
- os: ubuntu-latest | |
zip_command_debug: zip --quiet -r CoseSignTool-Linux-debug.zip ./published/debug/ | |
zip_command_release: zip --quiet -r CoseSignTool-Linux-release.zip ./published/release/ | |
- os: macos-latest | |
zip_command_debug: zip --quiet -r CoseSignTool-MacOS-debug.zip ./published/debug/ | |
zip_command_release: zip --quiet -r CoseSignTool-MacOS-release.zip ./published/release/ | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Zip command | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: choco install zip | |
- name: Get list of tags | |
run: | | |
oldest=${{ github.event.inputs.oldest }} | |
newest=${{ github.event.inputs.newest }} | |
git fetch --quiet | |
tags=$(git tag --list --sort=version:refname | awk -v old=$oldest -v new=$newest '$0 >= old && $0 <= new') | |
echo "tags = $tags" | |
echo "tagsToUpdate=$(echo $tags)" >> $GITHUB_ENV | |
shell: bash | |
- name: Release assets for selected tags | |
run: | | |
git fetch --tags | |
for tag in ${{ env.tagsToUpdate }}; do | |
echo "**** Checkout $tag ****" | |
git checkout "$tag" --quiet | |
echo "**** Build and publish $tag ****" | |
rm -rf published/debug | |
dotnet publish --configuration Debug --self-contained true --output published/debug CoseSignTool/CoseSignTool.csproj | |
rm -rf published/release | |
dotnet publish --configuration Release --self-contained true --output published/release CoseSignTool/CoseSignTool.csproj | |
echo "publish succeeded" | |
echo "**** Copy documentation for $tag ****" | |
for folder in debug release; do | |
mkdir -p published/$folder/docs | |
cp -r docs/* published/$folder/docs/ | |
cp -r LICENSE published/$folder/ | |
cp -r *.md published/$folder/ | |
done | |
echo "**** Create zip files for $tag ****" | |
${{ matrix.zip_command_debug }} | |
${{ matrix.zip_command_release }} | |
find . -type f -name "*.zip" | |
echo "**** Upload zip files to GitHub ****" | |
gh release upload $tag ./CoseSignTool-*.zip --clobber | |
done | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} |