π Release #29
Workflow file for this run
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: π Release | |
on: | |
release: {types: [published]} | |
workflow_dispatch: {} | |
jobs: | |
build-web: | |
name: Build the frontend | |
runs-on: ubuntu-latest | |
env: {FORCE_COLOR: 'true', NPM_PREFIX: './web'} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: {node-version-file: ./web/package.json, cache: 'npm', cache-dependency-path: ./web/package-lock.json} | |
- run: npm --prefix "$NPM_PREFIX" install -dd --no-audit | |
- run: npm --prefix "$NPM_PREFIX" run generate | |
- run: npm --prefix "$NPM_PREFIX" run build | |
- uses: actions/upload-artifact@v4 | |
with: {name: web-dist, path: ./web/dist/, if-no-files-found: error, retention-days: 1} | |
build-app: | |
name: Build the app | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [linux, darwin, windows] | |
arch: [amd64, arm64] | |
needs: [build-web] | |
steps: | |
- uses: actions/checkout@v4 | |
- {uses: gacts/github-slug@v1, id: slug} | |
- id: values | |
run: | | |
echo "bin-name=webhook-tester-${{ matrix.os }}-${{ matrix.arch }}`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`" >> $GITHUB_OUTPUT | |
- {uses: actions/setup-go@v5, with: {go-version-file: go.mod}} | |
- run: go install "github.com/oapi-codegen/oapi-codegen/v2/cmd/[email protected]" | |
- run: go generate -skip readme ./... | |
- {uses: actions/download-artifact@v4, with: {name: web-dist, path: ./web/dist}} # put the built frontend | |
- env: | |
GOOS: ${{ matrix.os }} | |
GOARCH: ${{ matrix.arch }} | |
CGO_ENABLED: 0 | |
LDFLAGS: -s -w -X gh.tarampamp.am/webhook-tester/v2/internal/version.version=${{ steps.slug.outputs.version-semantic }} | |
run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.bin-name }}" ./cmd/webhook-tester/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: webhook-tester-${{ matrix.os }}-${{ matrix.arch }} | |
path: ./${{ steps.values.outputs.bin-name }} | |
if-no-files-found: error | |
retention-days: 1 | |
- uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./${{ steps.values.outputs.bin-name }} | |
asset_name: ${{ steps.values.outputs.bin-name }} | |
tag: ${{ github.ref }} | |
build-deb-package: | |
name: Build the Debian package | |
runs-on: ubuntu-latest | |
strategy: {matrix: {arch: [amd64, arm64]}} | |
needs: [build-app] | |
steps: | |
- {uses: gacts/github-slug@v1, id: slug} | |
- {uses: actions/download-artifact@v4, with: {name: "webhook-tester-linux-${{ matrix.arch }}"}} | |
- id: values | |
run: | | |
majorMinorPatch="${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}.${{ steps.slug.outputs.version-patch }}" | |
echo "version=${majorMinorPatch}" >> $GITHUB_OUTPUT | |
echo "pkg-name=webhook-tester_${majorMinorPatch}-1_${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
- run: | | |
mkdir -p ./${{ steps.values.outputs.pkg-name }}/usr/local/bin ./${{ steps.values.outputs.pkg-name }}/DEBIAN | |
mv ./webhook-tester-linux-${{ matrix.arch }} ./${{ steps.values.outputs.pkg-name }}/usr/local/bin/webhook-tester | |
echo -e "Package: webhook-tester\nVersion: ${{ steps.values.outputs.version }}" > ./${{ steps.values.outputs.pkg-name }}/DEBIAN/control | |
echo -e "Architecture: ${{ matrix.arch }}\nMaintainer: ${{ github.actor }}" >> ./${{ steps.values.outputs.pkg-name }}/DEBIAN/control | |
echo -e "Description: Powerful tool for testing WebHooks and more" >> ./${{ steps.values.outputs.pkg-name }}/DEBIAN/control | |
dpkg-deb --build --root-owner-group ${{ steps.values.outputs.pkg-name }} | |
- uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./${{ steps.values.outputs.pkg-name }}.deb | |
asset_name: webhook-tester-linux-${{ matrix.arch }}.deb | |
tag: ${{ github.ref }} | |
build-docker-image: | |
name: Build the docker image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_LOGIN }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- {uses: gacts/github-slug@v1, id: slug} | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
build-args: "APP_VERSION=${{ steps.slug.outputs.version-semantic }}" | |
tags: | | |
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:latest | |
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }} | |
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }} | |
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }} | |
docker.io/tarampampam/webhook-tester:latest | |
docker.io/tarampampam/webhook-tester:${{ steps.slug.outputs.version }} | |
docker.io/tarampampam/webhook-tester:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }} | |
docker.io/tarampampam/webhook-tester:${{ steps.slug.outputs.version-major }} | |
deploy-on-render: | |
name: Deploy on Render | |
runs-on: ubuntu-latest | |
concurrency: {group: render} | |
environment: {name: render} | |
needs: [build-docker-image] | |
steps: | |
- {uses: gacts/github-slug@v1, id: slug} | |
# https://render.com/docs/deploy-an-image#deploy-via-webhook | |
- run: curl -SsL "https://api.render.com/deploy/${SRV}?key=${KEY}&imgURL=${IMG}:${TAG}" | |
env: | |
SRV: ${{ secrets.RENDER_COM_SERVICE_ID }} | |
KEY: ${{ secrets.RENDER_COM_DEPLOY_KEY }} | |
IMG: docker.io/tarampampam/webhook-tester | |
TAG: ${{ steps.slug.outputs.version }} # the same as in the "build-docker-image" job |