Fix rerelease workflow again #8
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: | |
pull_request: | |
branches: [ "*" ] # Take this out once it works | |
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 | |
dir_command: gci -Recurse | |
zip_command_debug: Compress-Archive -Path ./published/debug/ -DestinationPath CoseSignTool-Windows-debug.zip | |
zip_command_release: Compress-Archive -Path ./published/release/ -DestinationPath CoseSignTool-Windows-release.zip | |
find_zips: dir /s /b *.zip | |
- os: ubuntu-latest | |
dir_command: ls -a -R | |
zip_command_debug: zip --quiet -r CoseSignTool-Linux-debug.zip ./published/debug/ | |
zip_command_release: zip --quiet -r CoseSignTool-Linux-release.zip ./published/release/ | |
find_zips: find . -type f -name "*.zip" | |
- os: macos-latest | |
dir_command: ls -a -R | |
zip_command_debug: zip --quiet -r CoseSignTool-MacOS-debug.zip ./published/debug/ | |
zip_command_release: zip --quiet -r CoseSignTool-MacOS-release.zip ./published/release/ | |
find_zips: find . -type f -name "*.zip" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get list of tags | |
run: | | |
oldest=v1.2.3 | |
newest=v1.2.4 | |
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 "**** List files in CoseSignTool directory ****" | |
ls -a CoseSignTool | |
echo "**** Build and publish $tag ****" | |
dotnet publish --configuration Debug --self-contained true --output published/debug CoseSignTool/CoseSignTool.csproj | |
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 }} | |
${{ matrix.find_zips }} | |
echo "**** Upload zip files to GitHub ****" | |
gh release upload $tag ./CoseSignTool-*.zip --clobber | |
done | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} |