Trying again #3
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: Sign and Release Module | |
on: | |
push: | |
branches: | |
- 'release/*' | |
jobs: | |
sign_and_release_module: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 # Use the latest version of checkout | |
with: | |
node-version: '20' | |
- name: Install GPG | |
run: sudo apt-get update && sudo apt-get install gnupg -y | |
- name: Import GPG key | |
run: echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 --decode | gpg --import | |
- name: Extract version and rawname from module.xml | |
id: extract_info # Add an ID for later reference | |
run: | | |
version=$(awk -F'[><]' '/<version>/{print $3}' /location/of/module/module.xml) | |
rawname=$(awk -F'[><]' '/<rawname>/{print $3}' /location/of/module/module.xml) | |
echo "::set-output name=version::$version" | |
echo "::set-output name=rawname::$rawname" | |
- name: Sign module | |
run: | | |
gpg --batch --yes --armor --detach-sign /location/of/module/${{ steps.extract_info.outputs.rawname }}-${{ steps.extract_info.outputs.version }}.tar.gz # Using outputs for variables | |
- name: Push signed module to releases | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: /location/of/module/${{ steps.extract_info.outputs.rawname }}-${{ steps.extract_info.outputs.version }}.tar.gz.asc | |
tag_name: v${{ steps.extract_info.outputs.version }} | |
title: Release ${{ steps.extract_info.outputs.version }} | |
token: ${{ secrets.GITHUB_TOKEN }} |