Create Signed Tag Manually #7
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: Create Signed Tag Manually | |
on: | |
workflow_dispatch: | |
branches: master | |
inputs: | |
tag_name: | |
description: 'Tag name to create' | |
required: true | |
default: '' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.ROBO_ACTIONS }} | |
- name: Check Tag Name | |
id: check_tag_name | |
if: ${{ github.event.inputs.tag_name != '' }} | |
uses: actions-ecosystem/action-regex-match@v2 | |
with: | |
text: ${{ github.event.inputs.tag_name }} | |
regex: '^\d+\.\d+\.\d+$' | |
- name: GPG Import | |
if: ${{ steps.check_tag_name.outputs.match != '' }} | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.NEW_SIGNING_STUFF }} | |
passphrase: ${{ secrets.SIGNING_BONUS_PHRASE }} | |
git_user_signingkey: true | |
git_tag_gpgsign: true | |
- name: Sign and Push Tag | |
id: create_archive | |
if: ${{ steps.check_tag_name.outputs.match != '' }} | |
run: | | |
git config tar.tar.gz.command 'gzip -cn' | |
git tag -s ${{ github.event.inputs.tag_name }} -m 'Tag for ${{ github.event.inputs.tag_name }} release' | |
git push origin ${{ github.event.inputs.tag_name }} | |
REPO=$(basename "$(pwd)") | |
TAG=${{ github.event.inputs.tag_name }} | |
FNAME=${REPO}-${TAG#v} | |
echo "fname=$FNAME" >> $GITHUB_OUTPUT | |
URL="https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/${{ github.event.inputs.tag_name }}.zip" | |
git archive --prefix=${REPO}-${TAG#v}/ -o ${FNAME}.tar.gz ${TAG} | |
gpg --detach-sign --pinentry-mode loopback --passphrase ${{ secrets.SIGNING_BONUS_PHRASE }} ${FNAME}.tar.gz | |
curl -L -o ${FNAME}.zip ${URL} | |
gpg --detach-sign --pinentry-mode loopback --passphrase ${{ secrets.SIGNING_BONUS_PHRASE }} ${FNAME}.zip | |
- name: Create Release | |
if: ${{ steps.check_tag_name.outputs.match != '' }} | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.ROBO_ACTIONS }} | |
name: ${{ steps.create_archive.outputs.fname }} | |
tag: ${{ github.event.inputs.tag_name }} | |
body: | | |
Changes in this Release | |
- First Change | |
- Second Change | |
draft: true | |
prerelease: false | |
artifacts: "./${{ steps.create_archive.outputs.fname }}.tar.gz.sig, ./${{ steps.create_archive.outputs.fname }}.zip.sig" |