Skip to content

Merge pull request #341 from hearchco/as/fix/suggestions-api #21

Merge pull request #341 from hearchco/as/fix/suggestions-api

Merge pull request #341 from hearchco/as/fix/suggestions-api #21

Workflow file for this run

name: CD
on:
push:
tags: ["v*.*.*"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate go code from go:generate comments
run: make install
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean --config goreleaser/release.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Artifact Linux
uses: actions/upload-artifact@v4
with:
name: build_linux
path: dist/*linux*
- name: Artifact Darwin
uses: actions/upload-artifact@v4
with:
name: build_darwin
path: dist/*darwin*
- name: Artifact Windows
uses: actions/upload-artifact@v4
with:
name: build_windows
path: dist/*windows*
deploy:
runs-on: ubuntu-latest
needs: goreleaser
steps:
- name: Trigger backend deployment workflow in the infrastructure repository
run: |
repo_owner="${{ github.repository_owner }}"
repo_name="infra"
event_type="deploy-backend"
environment="prod"
version="${{ github.ref_name }}"
download_url_amd64="https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/hearchco_${{ github.ref_name }}_linux_amd64"
download_url_arm64="https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/hearchco_${{ github.ref_name }}_linux_arm64"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DEPLOY_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"environment\": \"$environment\", \"version\": \"$version\", \"download_url_amd64\": \"$download_url_amd64\", \"download_url_arm64\": \"$download_url_arm64\", \"unit\": false, \"integration\": true}}"