This repository was archived by the owner on Dec 6, 2023. It is now read-only.
File tree 2 files changed +52
-46
lines changed
2 files changed +52
-46
lines changed Original file line number Diff line number Diff line change 1
1
name : CI
2
- on : [push, pull_request]
2
+ on : [pull_request]
3
3
jobs :
4
- go_lint :
5
- name : Go lint
6
- runs-on : ubuntu-latest
7
- steps :
8
- - uses : actions/checkout@v2
9
- - name : golangci-lint
10
- uses : golangci/golangci-lint-action@v2
11
- with :
12
- working-directory : check-commit
13
4
check_commit :
14
- if : ${{ github.event_name == 'pull_request' }}
15
5
name : HAProxy check commit message
16
6
runs-on : ubuntu-latest
17
7
steps :
18
8
- uses : actions/checkout@v2
19
9
with :
20
10
fetch-depth : 0
21
11
- name : check-commit
22
- uses : docker://haproxytech/check- commit:latest
12
+ uses : docker://ghcr.io/ haproxytech/commit-check:3.0.0
23
13
env :
24
14
API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
- go_build :
26
- name : Go build
27
- runs-on : ubuntu-latest
28
- needs : ["go_lint"]
29
- steps :
30
- - name : Check out code into the Go module directory
31
- uses : actions/checkout@v2
32
- - name : Set up Go 1.17
33
- uses : actions/setup-go@v2
34
- with :
35
- go-version : 1.17
36
- id : go
37
- - name : Get dependencies
38
- run : |
39
- cd check-commit && go get -v -t -d ./...
40
- - name : Build
41
- run : |
42
- cd check-commit && go build -v .
43
- go_test :
44
- name : Go test
45
- runs-on : ubuntu-latest
46
- needs : ["go_lint"]
47
- steps :
48
- - uses : actions/checkout@v2
49
- - uses : actions/setup-go@v2
50
- with :
51
- go-version : 1.17
52
- id : go
53
- - name : Get dependencies
54
- run : |
55
- cd check-commit && go get -v -t -d ./...
56
- - name : Build
57
- run : |
58
- cd check-commit && go test ./...
Original file line number Diff line number Diff line change
1
+ name : ghcr.io image
2
+
3
+ on :
4
+ push :
5
+ # Publish `main` as Docker `latest` image.
6
+ branches :
7
+ - main
8
+
9
+ # Publish `v1.2.3` tags as releases.
10
+ tags :
11
+ - v*
12
+
13
+ env :
14
+ IMAGE_NAME : go-linter
15
+
16
+ jobs :
17
+ # Push image to GitHub Packages.
18
+ # See also https://docs.docker.com/docker-hub/builds/
19
+ push :
20
+ runs-on : ubuntu-latest
21
+ permissions :
22
+ packages : write
23
+ contents : read
24
+
25
+ steps :
26
+ - uses : actions/checkout@v2
27
+
28
+ - name : Build image
29
+ run : docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
30
+
31
+ - name : Log in to registry
32
+ # This is where you will update the PAT to GITHUB_TOKEN
33
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
34
+
35
+ - name : Push image
36
+ run : |
37
+ IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
38
+
39
+ # Change all uppercase to lowercase
40
+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
41
+ # Strip git ref prefix from version
42
+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
43
+ # Strip "v" prefix from tag name
44
+ [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
45
+ # Use Docker `latest` tag convention
46
+ [ "$VERSION" == "main" ] && VERSION=latest
47
+ echo IMAGE_ID=$IMAGE_ID
48
+ echo VERSION=$VERSION
49
+ docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
50
+ docker push $IMAGE_ID:$VERSION
You can’t perform that action at this time.
0 commit comments