Skip to content

Issue comment

Issue comment #39

Workflow file for this run

name: commands
run-name: Issue comment
on:
issue_comment:
types:
- created
jobs:
build:
if: ${{ contains(github.event.comment.body, '/rebuild') }}
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: kaisugi/[email protected]
with:
text: ${{ github.event.comment.body }}
regex: '^/rebuild(\+[a-z]*)?\s*([\w\.]+)$'
id: command_regex
- uses: kaisugi/[email protected]
with:
text: ${{ steps.regex.outputs.group2 }}
regex: '^[\d\.]+-?(beta|)([\d\.]+)?snap\d+$'
id: tag_regex
- uses: actions/checkout@v4
- uses: ./.github/actions/build
with:
ref: ${{ steps.command_regex.outputs.group2 }}
id: build
- run: echo "${{ matrix.arch }}=${{ steps.build.outputs.snap }}" >> $GITHUB_OUTPUT
id: snap
- run: gh issue comment "${{ github.event.issue.number }}" --body "Rebuild completed successfully for ${{ steps.command_regex.outputs.group2 }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
outputs:
amd64: ${{ steps.snap.outputs.amd64 }}
command_suffix: ${{ steps.command_regex.outputs.group1 }}
tag: ${{ steps.command_regex.outputs.group2 }}
channel: ${{ steps.tag_regex.outputs.group1 }}
test:
needs: build
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test
with:
snap: ${{ needs.build.outputs[matrix.arch] }}
release:
needs:
- build
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/release
with:
tag: ${{ needs.build.outputs.tag }}
channel: ${{ needs.build.outputs.channel || 'stable' }}
update: true
- run: gh issue comment "${{ github.event.issue.number }}" --body "Release files were updated for ${{ needs.build.outputs.tag }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
publish:
if: ${{ needs.build.outputs.command_suffix == '+publish' }}
needs:
- build
- test
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/publish
with:
snap: ${{ needs.build.outputs[matrix.arch] }}
channel: ${{ needs.build.outputs.channel || 'stable' }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
- run: gh issue comment "${{ github.event.issue.number }}" --body "Version ${{ needs.build.outputs.tag }} was published on snapcraft.io"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
failure:
if: ${{ failure() || cancelled() }}
needs:
- build
- test
- release
- publish
runs-on: ubuntu-latest
steps:
- run: gh issue comment "${{ github.event.issue.number }}" --body "Rebuilding ${{ needs.build.outputs.tag }} failed (see logs)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}