This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
chore: better readme #6
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: Build Swap | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'swapapi/**' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Get commit message | |
id: commit_message | |
uses: sergeysova/jq-action@v2 | |
with: | |
cmd: echo -n "${{github.event.head_commit.message}}" | jq -Rsa . | sed -e 's/^"//' -e 's/"$//' | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: swapapi | |
build-args: | | |
RELEASE=${{ github.run_number }} | |
GH_CI_USER=${{ secrets.GH_CI_USER }} | |
GH_CI_TOKEN=${{ secrets.GH_CI_TOKEN }} | |
push: true | |
tags: ghcr.io/crestalnetwork/ethglobal-bangkok-swag:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- | |
name: Post to a Slack channel | |
if: ${{ success() }} | |
id: slack-success | |
uses: slackapi/[email protected] | |
with: | |
channel-id: 'C0786MHAL8J' | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "`${{ github.repository }}`\n*Branch*: `${{ github.ref_name }}`\n*Build result*: (${{ github.run_number }}) *${{ job.status }}* 🟩\n*Changes*:\n${{ steps.commit_message.outputs.value }}\n*Diff*: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- | |
name: Post to a Slack channel | |
if: ${{ failure() }} | |
id: slack-failure | |
uses: slackapi/[email protected] | |
with: | |
channel-id: 'C0786MHAL8J' | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "`${{ github.repository }}`\n*Branch*: `${{ github.ref_name }}`\n*Build result*: (${{ github.run_number }}) *${{ job.status }}* 🟥\n*Build Log*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Changes*:\n${{ steps.commit_message.outputs.value }}\n*Diff*: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |