-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (59 loc) · 1.93 KB
/
push-artifacts.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
61
62
63
64
name: Push Artifacts
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
create-release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: rymndhng/release-on-push-action@master
id: release
with:
bump_version_scheme: minor
push-release-assets-matrix:
name: Release Go Binary
needs: [create-release]
runs-on: ubuntu-latest
env:
GOARM: "7"
strategy:
matrix:
goos: [linux]
goarch: ["386", amd64, arm64, arm]
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "1.18"
ldflags: "-X 'main.commit=${{ github.sha }}' -X 'main.version=${{ needs.create-release.outputs.tag_name }}'"
md5sum: FALSE
sha256sum: TRUE
project_path: "./server"
binary_name: "jarvis"
release_tag: ${{ needs.create-release.outputs.tag_name }}
asset_name: jarvis-${{ matrix.goos }}-${{ matrix.goarch }}
push-docker-image:
runs-on: ubuntu-latest
needs: [create-release]
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -f ./Dockerfile ./server --tag jarvis:latest --build-arg JARVIS_BUILD_COMMIT=${{ github.sha }} --build-arg JARVIS_BUILD_VERSION=${{ needs.create-release.outputs.tag_name }}
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin
- name: Push image
run: |
REMOTE_NAME="ghcr.io/${{ github.repository_owner }}/jarvis:latest"
docker tag jarvis:latest $REMOTE_NAME
docker push $REMOTE_NAME