[Request] Restart Command #113
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: Snapshot | |
on: | |
issue_comment: | |
types: [created, edited] | |
jobs: | |
Snapshot: | |
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/snapshot') && github.event.comment.user.login == 'natesales' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get snapshot ID | |
id: snapshot_id | |
run: | | |
echo SNAPSHOT_ID=pathvector_$(git describe --tags "$(git rev-list --tags --max-count=1)" | cut -c2-)-SNAPSHOT-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT | |
- name: Add start comment | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Starting snapshot release [`${{ steps.snapshot_id.outputs.SNAPSHOT_ID }}`](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Install PDF generation dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pandoc texlive-xetex | |
- run: go generate -x | |
- run: mv pathvector*.pdf ${{ steps.snapshot_id.outputs.SNAPSHOT_ID }}.pdf | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: latest | |
args: release --snapshot --rm-dist --release-header distrib/snapshot-header.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.snapshot_id.outputs.SNAPSHOT_ID }} snapshot release | |
path: | | |
dist/pathvector*.deb | |
dist/pathvector*.rpm | |
dist/pathvector*checksums.txt | |
dist/pathvector*.tar.gz | |
pathvector*.pdf | |
- name: Post end comment | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Finished snapshot release [`${{ steps.snapshot_id.outputs.SNAPSHOT_ID }}`](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |