Skip to content

Create OnTag.yml

Create OnTag.yml #50

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: perl-deploy-gpg
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags: '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ ( ( startsWith(matrix.os, 'ubuntu:') && 'ubuntu-latest' ) || ( startsWith(matrix.os, 'macos:') && 'macos-latest' ) || startsWith(matrix.os, 'windows:') && 'windows-latest' ) || matrix.os }}
env:
MM_SIGN_DIST: 1
TEST_SIGNATURE: 1
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ] # gpg redirection doesn't work from windows; only need to deploy once anyway [ 'windows-latest', 'ubuntu-latest' ]
perl: [ '5.32' ] # [ '5.12', '5.32', '5.34']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Set up GPG per https://stackoverflow.com/a/66457517/5508606 ; updated by most recent example in action repo
- name: Import GPG Key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
# official example
- name: GPG user IDs
run: |
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
echo "name: ${{ steps.import_gpg.outputs.name }}"
echo "email: ${{ steps.import_gpg.outputs.email }}"
# trust myself
- name: Update Trust = Trust myself
id: trust_myself
run: |
# perl -le 'print for qw/trust 5 y quit/' | gpg --no-tty --command-fd 0 --edit-key 0x85FA5F2CF71E1CD6
gpg --no-tty --command-fd 0 --edit-key 0x85FA5F2CF71E1CD6 << EOTRUST
trust
5
y
quit
EOTRUST
- name: Set up perl ${{ matrix.perl }} ${{ matrix.os }} ${{ matrix.joblabel }}
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
multi-thread: ${{ ( ( startsWith(matrix.os, 'windows') || endsWith(matrix.os, ':thr') ) && true ) || false }}
distribution: ${{ ( endsWith(matrix.os, ':strawberry') && 'strawberry' ) || 'default' }}
- name: Pre-Makefile.PL prereqs for older perls
if: ${{ matrix.perl < '5.14' }}
run: |
cpanm --notest ExtUtils::MakeMaker
- name: Install pre-reqs
run: |
cpanm --notest Module::Signature
cpanm --notest File::Which File::Fetch File::Spec Archive::Extract
perl Makefile.PL
cpanm --notest --installdeps .
- name: Build & Sign
run: |
perl Makefile.PL
make
make distauthtest
make dist
make veryclean
- name: Variable Expriment
id: varex
run: |
# exporting doesn't help; variable must be used in same step as it is populated.
MYVAR=`ls *.tar.gz`
echo first MYVAR _ $MYVAR _
# https://github.community/t/how-to-set-action-env-variables-within-a-shell-script/18425
# echo "::set-env name=MYVAR::$MYVAR" ## The set-env command is disabled
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions
echo "::set-output name=MY_OUTPUT::$MYVAR"
- name: report the results of calculating the version
run: |
echo "the result is _ ${{ env.MYVAR }} _"
echo "the varex output is _ ${{ steps.varex.outputs.MY_OUTPUT }} _"
## get the name into the YML using the steps.varex.outputs.* syntax, so I can do file: and asset_name: correctly
- name: Store tarball as asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ steps.varex.outputs.MY_OUTPUT }}
asset_name: ${{ steps.varex.outputs.MY_OUTPUT }}
tag: ${{ github.ref }}
overwrite: true
body: "Some release text goes here, but only if this action was a branch that forces a tag"
# output
#- name: signed artifact
# uses: actions/upload-artifact@v2
# with:
# name: Makefile.Transport.asc
# path: ./Makefile.Transport.asc
# output
#- name: encrypted artifact
# uses: actions/upload-artifact@v2
# with:
# name: Makefile.encrypted.asc
# path: ./Makefile.encrypted.asc