Debug the entrypoint #54
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 binaries | |
on: | |
push: | |
branches: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21.1' | |
- name: Extract branch name | |
shell: bash | |
run: | | |
OBJECT_SUFFIX='' | |
DOCKER_TAG="latest" | |
if [[ "${GITHUB_REF_NAME}" != "main" ]]; then | |
OBJECT_SUFFIX=".${GITHUB_REF_NAME}" | |
DOCKER_TAG="${GITHUB_REF_NAME}" | |
fi | |
echo "object_suffix=${OBJECT_SUFFIX}" >> $GITHUB_ENV | |
echo "docker_tag=${DOCKER_TAG}" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Run Go builds | |
run: | | |
OBJECT_SUFFIX="${{ env.object_suffix }}" | |
mkdir output/ | |
go build -o "output/modem-stats${OBJECT_SUFFIX}.x86" main.go | |
GOARCH=arm GOARM=5 go build -o "output/modem-stats${OBJECT_SUFFIX}.arm5" main.go | |
GOOS=darwin GOARCH=arm64 go build -o "output/modem-stats${OBJECT_SUFFIX}.macos-arm64" main.go | |
- name: Push binaries to B2 | |
uses: jakejarvis/s3-sync-action@master | |
env: | |
AWS_S3_BUCKET: modem-stats | |
AWS_ACCESS_KEY_ID: ${{ secrets.B2_APPKEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.B2_APPKEY }} | |
SOURCE_DIR: 'output' | |
AWS_S3_ENDPOINT: 'https://s3.us-west-000.backblazeb2.com/' | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
tags: msh100/modem-stats:${{ env.docker_tag }} | |
build-args: | | |
OBJECT_SUFFIX=${{ env.object_suffix }} | |
context: . |