Skip to content

Re-release Assets

Re-release Assets #1

Workflow file for this run

#### 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'
required: true
default: 'v0.3.1'
newest:
description: 'Newest release to include'
required: true
default: 'current'
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 ./debug/ -DestinationPath CoseSignTool-Windows-debug.zip
zip_command_release: Compress-Archive -Path ./release/ -DestinationPath CoseSignTool-Windows-release.zip
- os: ubuntu-latest
dir_command: ls -a -R
zip_command_debug: zip -r CoseSignTool-Linux-debug.zip ./debug/
zip_command_release: zip -r CoseSignTool-Linux-release.zip ./release/
- os: macos-latest
dir_command: ls -a -R
zip_command_debug: zip -r CoseSignTool-MacOS-debug.zip ./debug/
zip_command_release: zip -r CoseSignTool-MacOS-release.zip ./release/
steps:
# Checkout the branch.
- name: Checkout repository
uses: actions/checkout@v4
- name: Get list of tags
run: |
oldest=${{ github.event.inputs.oldest }}
newest=${{ github.event.inputs.newest }}
tags=$(git tag --sort=creatordate "$oldest".."$newest")
echo "tagsToUpdate=[$(echo $tags | tr ' ' ',')]" >> $GITHUB_ENV
- name: Release assets for selected tags
run: |
for tag in ${{ env.tagsToUpdate }}; do
echo "**** Release $tag ****\n******************************\n"
# Run checkout action
echo "::group::Checkout"
echo "Checkout tagged release"
- name: Checkout tagged release
uses: actions/checkout@v4
with:
ref: $tag
echo "::endgroup::"
# Build and publish the binaries to ./published.
echo "::group::Publish"
echo "Build and publish"
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
# Self-contained is needed. Must use .csproj instead of .sln.
echo "::endgroup::"
# Copy the docs, license, and markdown files to the release folders.
echo "::group::Copy"
echo "Copy documentation"
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 "::endgroup::"
# Create zip files for release.
echo "::group::Zips"
echo "Create zip files for the release"
${{ matrix.zip_command_debug }}
${{ matrix.zip_command_release }}
${{ matrix.dir_command }}
echo "::endgroup::"
# Upload the zipped assets to the release.
echo "::group::Upload"
echo "Upload .zip files to Github"
- name: Upload artifacts
id: upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./published/CoseSignTool-*.zip
file_glob: true
overwrite: true
tag: ${{ needs.create_release.outputs.tag_name }}
echo "::endgroup::"
done