Skip to content

refactor(main): using v2.0.0 #12

refactor(main): using v2.0.0

refactor(main): using v2.0.0 #12

Workflow file for this run

name: GO
on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.20.x
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: build --snapshot --clean --timeout=1h
- uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2
- uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: ${{ (github.event_name == 'push') }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_RELEASE_PAT }}
- name: Copy file
run: |
cp dist/robot_linux_amd64_v1/robot robot
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: build (and publish) main image
if: ${{ (github.event_name == 'push') }}
run: |
docker buildx build \
--platform linux/amd64 \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/robot" \
--push \
-t ghcr.io/${{ github.repository_owner }}/robot:${{ env.GIT_COMMIT_SHORT_SHA }} \
-f Dockerfile \
.
- name: build main image
if: ${{ (github.event_name != 'push') }}
run: |
docker buildx build \
--platform linux/amd64 \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/robot" \
-t ghcr.io/${{ github.repository_owner }}/robot:${{ env.GIT_COMMIT_SHORT_SHA }} \
-f Dockerfile \
.