Whats another commit #12
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@v4 | |
with: | |
path : ${{ github.event.repository.name }} | |
- name: Install GPG | |
run: sudo apt-get update && sudo apt-get install gnupg xmlstarlet -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 | |
run: | | |
version=$(awk -F'[><]' '/<version>/{print $3; exit}' ./${{ github.event.repository.name }}/module.xml) | |
rawname=$(awk -F'[><]' '/<rawname>/{print $3; exit}' ./${{ github.event.repository.name }}/module.xml) | |
echo "MODULE_VERSION=$version" >> $GITHUB_ENV | |
echo "MODULE_RAWNAME=$rawname" >> $GITHUB_ENV | |
# Assuming your module build/packaging places the file and signing script in the working directory | |
- name: Sign module | |
run: | | |
chmod +x ./${{ github.event.repository.name }}/.github/workflows/sign.sh | |
./${{ github.event.repository.name }}/.github/workflows/sign.sh ${{env.MODULE_RAWNAME}} "${{ secrets.GPG_SIGNING_KEY }}" ./${{ github.event.repository.name }}/.github/workflows/exclude.txt | |
- name: Push signed module to releases | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{env.MODULE_RAWNAME}}-${{env.MODULE_VERSION}}.tar.gz | |
tag_name: v${env.MODULE_VERSION} | |
title: Release ${{env.MODULE_VERSION}} | |
token: ${{ secrets.GITHUB_TOKEN }} |