Skip to content

Commit

Permalink
Create release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktank authored Nov 18, 2021
1 parent 70167de commit 02b7daf
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build Release
on:
push:
tags:
- 'v?[0-9]+.[0-9]+.[0-9]+'
- 'v?[0-9]+.[0-9]+.[0-9]+-[RT]C[0-9]+'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get GitHub slug info
uses: rlespinasse/github-slug-action@3.5.1

- name: Pack it up!
run: tar -czf /tmp/${{ github.event.repository.name }}-${{ env.GITHUB_SHA_SHORT }}-${{ env.GITHUB_REF_SLUG_CS }}.crbl .

- name: Release
if: ${{ success() }}
id: release
uses: softprops/action-gh-release@5e3f23f92c903aac25270f66388fdcb366c5b549
with:
prerelease: ${{ contains(github.ref, 'RC') || contains(github.ref, 'TC') }}
files: /tmp/${{ github.event.repository.name }}-${{ env.GITHUB_SHA_SHORT }}-${{ env.GITHUB_REF_SLUG_CS }}.crbl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get release info
if: ${{ success() }}
id: release_info
uses: cardinalby/git-get-release-action@1.1.1
with:
releaseId: "${{ steps.release.outputs.id }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Extract timestamp
if: ${{ success() }}
run: |
echo "TIMESTAMP=$(date +%s -d "${{ steps.release_info.outputs.published_at }}")" >> $GITHUB_ENV
- name: Slack notification (production releases only)
if: ${{ success() && steps.release_info.outputs.prerelease == 'false' }}
id: slack
uses: wearerequired/slack-messaging-action@v1
with:
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
payload: >-
{
"attachments": [
{
"fallback": "${{ github.event.repository.name }} has been updated.",
"color": "#00cccc",
"pretext": "A new release for ${{ github.event.repository.name }} was published on Github!",
"title": "${{ github.event.repository.name }} - ${{ steps.release_info.outputs.tag_name }}",
"title_link": "${{ steps.release_info.outputs.html_url }}",
"text": ${{ toJSON(steps.release_info.outputs.body) }},
"footer": "PackBot",
"footer_icon": "https://cribl.io/favicon.ico",
"ts": ${{ env.TIMESTAMP }}
}
]
}

0 comments on commit 02b7daf

Please sign in to comment.