Skip to content

update settings

update settings #25

Workflow file for this run

name: Release
on:
push:
branches:
- main
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
prepare-release:
needs: test
runs-on: ubuntu-latest
outputs:
current_version: ${{ steps.version.outputs.current_version }}
tag_exists: ${{ steps.tag_check.outputs.tag_exists }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- id: version
run: |
CURRENT_VERSION=$(jq -r '.version' package.json)
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- id: tag_check
run: |
if git rev-parse "v${{ steps.version.outputs.current_version }}" >/dev/null 2>&1; then
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi
release:
runs-on: ubuntu-latest
needs: prepare-release
if: ${{ needs.prepare-release.outputs.tag_exists == 'false' }}
steps:
- uses: actions/checkout@v4
- name: Add Tag
run: |
git tag "v${{ needs.prepare-release.outputs.current_version }}"
git push origin "v${{ needs.prepare-release.outputs.current_version }}"
- name: Create Release to GitHub
run: gh release create "v${{ needs.prepare-release.outputs.current_version }}" --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-publish:
runs-on: ubuntu-latest
needs: prepare-release
if: ${{ needs.prepare-release.outputs.tag_exists == 'false' }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}
tags: |
type=raw,value=latest
type=raw,value=v${{ needs.prepare-release.outputs.current_version }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
deploy-webhook:
runs-on: ubuntu-latest
needs: build-and-publish
steps:
- env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
run: |
TIMESTAMP=$(date +%s)
SIGNATURE=$(echo -n "$TIMESTAMP" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | awk '{print $2}')
curl -f -X POST "$WEBHOOK_URL" \
-H "X-Signature: $SIGNATURE" \
-H "X-Timestamp: $TIMESTAMP"