fix deadlock in approver #48
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: [ "main" ] | |
env: | |
IMAGE_NAME: shellyctl | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- name: Build Linux AMD64 | |
run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o shellyctl_linux_amd64 | |
- name: Build Linux ARM64 | |
run: GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o shellyctl_linux_arm64 | |
- name: Build Windows AMD64 | |
run: GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o shellyctl_windows_arm64 | |
- name: Test | |
run: go test -v ./... | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_REPOSITORY: jcodybaker/shellyctl | |
with: | |
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | |
files: | | |
shellyctl_linux_amd64 | |
shellyctl_linux_arm64 | |
shellyctl_windows_arm64 | |
- name: Build image | |
run: docker build . --file ./ci/Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push image | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |