github action: update for latest ways from netdisco

This commit is contained in:
Oliver Gorwits
2021-08-23 15:58:40 +01:00
parent 98281e7df6
commit 80b88fbbb4

View File

@@ -1,20 +1,20 @@
name: Test SNMP::Info name: Test and Publish SNMP::Info
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
debug_enabled:
description: 'Run debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
success_irc_squawk: success_irc_squawk:
description: 'Squawk to IRC on successful tests' description: 'Squawk to IRC on successful tests'
required: false required: false
default: false default: false
debug_test_enabled:
description: 'With build and test debug'
required: false
default: false
push: push:
branches: branches:
- master - master
tags: tags:
- '3.[0-9][0-9]' - '2.[0-9][0-9][0-9][0-9][0-9][0-9]'
jobs: jobs:
test_snmp_info: test_snmp_info:
name: Test and CPAN Upload name: Test and CPAN Upload
@@ -28,11 +28,8 @@ jobs:
run: run:
working-directory: /github/workspace/snmp-info/snmp-info working-directory: /github/workspace/snmp-info/snmp-info
steps: steps:
- name: Get the Tag and Branch - name: Get the Tag or Branch
id: get_refs run: echo "GH_REF_SHORT=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
run: |
echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=RELEASE_BRANCH::${GITHUB_REF#refs/heads/}
- name: Install packages - name: Install packages
run: apk add openssh xz tmux bash curl sudo gcc make musl-dev perl-dev unzip jq run: apk add openssh xz tmux bash curl sudo gcc make musl-dev perl-dev unzip jq
@@ -57,55 +54,67 @@ jobs:
continue-on-error: true continue-on-error: true
- name: IRC test failure notification - name: IRC test failure notification
if: (steps.build_and_run_tests.outcome == 'failure') && (github.event_name != 'workflow_dispatch')
uses: Gottox/irc-message-action@v2 uses: Gottox/irc-message-action@v2
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/heads/') && (steps.build_and_run_tests.outcome == 'failure')
with: with:
channel: '#netdisco' channel: '#netdisco'
nickname: github-actions nickname: github-actions
message: |- message: |-
🤖 ${{ github.actor }} pushed to ${{ steps.get_refs.outputs.RELEASE_BRANCH }}: https://github.com/${{ github.repository }}/commit/${{ github.sha }} 🤖 ${{ github.actor }} pushed to ${{ env.GH_REF_SHORT }}: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
😭 TESTS have FAILED! 👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} 😭 TESTS have FAILED! 👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: IRC test success notification - name: IRC test success notification
if: (steps.build_and_run_tests.outcome == 'success') && github.event.inputs.success_irc_squawk
uses: Gottox/irc-message-action@v2 uses: Gottox/irc-message-action@v2
if: github.event.inputs.success_irc_squawk && startsWith(github.ref, 'refs/heads/') && (steps.build_and_run_tests.outcome == 'success')
with: with:
channel: '#netdisco' channel: '#netdisco'
nickname: github-actions nickname: github-actions
message: |- message: |-
🤖 ${{ github.actor }} pushed to ${{ steps.get_refs.outputs.RELEASE_BRANCH }}: https://github.com/${{ github.repository }}/commit/${{ github.sha }} (tests PASSED 🎉) 🤖 ${{ github.actor }} pushed to ${{ env.GH_REF_SHORT }}: https://github.com/${{ github.repository }}/commit/${{ github.sha }} (tests PASSED 🎉)
- name: Upload dist to CPAN - name: Make release
if: steps.build_and_run_tests.outcome == 'success'
run: |
sudo -u netdisco /home/netdisco/bin/localenv rm ./MANIFEST
sudo -u netdisco /home/netdisco/bin/localenv ./Build manifest
sudo -u netdisco /home/netdisco/bin/localenv ./Build distmeta
sudo -u netdisco /home/netdisco/bin/localenv ./Build dist
- name: Upload to CPAN
id: upload_to_cpan id: upload_to_cpan
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') && (steps.build_and_run_tests.outcome == 'success') if: startsWith(github.ref, 'refs/tags/')
env: env:
PAUSE_USERNAME: ${{ secrets.PAUSE_USERNAME }} PAUSE_USERNAME: ${{ secrets.PAUSE_USERNAME }}
PAUSE_PASSWORD: ${{ secrets.PAUSE_PASSWORD }} PAUSE_PASSWORD: ${{ secrets.PAUSE_PASSWORD }}
run: | run: |
sudo -u netdisco /home/netdisco/bin/localenv ./Build dist bash -c 'RELEASENAME=(SNMP-Info-*.tar.gz) && ! curl -LI --fail https://cpan.metacpan.org/authors/id/O/OL/OLIVER/${RELEASENAME}'
sudo -u netdisco /home/netdisco/bin/localenv cpan-upload --user=$PAUSE_USERNAME --password=$PAUSE_PASSWORD SNMP-Info-*.tar.gz sudo -u netdisco /home/netdisco/bin/localenv cpan-upload -u '${{ env.PAUSE_USERNAME }}' -p '${{ env.PAUSE_PASSWORD }}' SNMP-Info-*.tar.gz
continue-on-error: true continue-on-error: true
- name: IRC upload failure notification - name: IRC upload failure notification
if: steps.upload_to_cpan.outcome == 'failure'
uses: Gottox/irc-message-action@v2 uses: Gottox/irc-message-action@v2
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') && (steps.upload_to_cpan.outcome == 'failure')
with: with:
channel: '#netdisco' channel: '#netdisco'
nickname: github-actions nickname: github-actions
message: |- message: |-
🤖 Failed to upload SNMP::Info release ${{ steps.get_refs.outputs.RELEASE_TAG }} to CPAN! 😭 🤖 Failed to upload SNMP::Info release ${{ env.GH_REF_SHORT }} to CPAN! 😭
👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} 👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: IRC upload success notification - name: IRC upload success notification
if: steps.upload_to_cpan.outcome == 'success'
uses: Gottox/irc-message-action@v2 uses: Gottox/irc-message-action@v2
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') && (steps.upload_to_cpan.outcome == 'success')
with: with:
channel: '#netdisco' channel: '#netdisco'
nickname: github-actions nickname: github-actions
message: |- message: |-
🤖 Uploaded SNMP::Info release ${{ steps.get_refs.outputs.RELEASE_TAG }} to CPAN 🎉 🤖 Uploaded SNMP::Info release ${{ env.GH_REF_SHORT }} to CPAN 🎉
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3
if: always() && github.event.inputs.debug_enabled && (github.event_name == 'workflow_dispatch') if: always() && github.event.inputs.debug_test_enabled
with: with:
sudo: true sudo: true
- name: Preserve status from tests
if: always() && (steps.build_and_run_tests.outcome == 'failure')
run: exit 1