This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (56 loc) · 1.99 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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/gh-rebot_linux_amd64_v1/gh-rebot gh-rebot
- 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 }}/gh-rebot" \
--push \
-t ghcr.io/${{ github.repository_owner }}/gh-rebot:${{ 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 }}/gh-rebot" \
-t ghcr.io/${{ github.repository_owner }}/gh-rebot:${{ env.GIT_COMMIT_SHORT_SHA }} \
-f Dockerfile \
.