Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
build: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
l3uddz committed Nov 4, 2022
1 parent 7dd3320 commit 94ee31d
Showing 1 changed file with 27 additions and 33 deletions.
60 changes: 27 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
# dependencies
- name: goreleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v3
with:
install-only: true
version: 1.7.0
Expand All @@ -31,20 +31,20 @@ jobs:
run: task --version

- name: qemu
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

# checkout
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

# setup go
- name: go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.19

Expand All @@ -54,26 +54,18 @@ jobs:
go env
# cache
- name: cache-paths
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: cache-build
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

- name: cache-mod
uses: actions/cache@v2
- name: cache-go
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-cache-mod
- name: cache-task
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .task/**/*
key: ${{ runner.os }}-go-task
Expand Down Expand Up @@ -109,19 +101,20 @@ jobs:
# artifacts
- name: artifact_linux
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: build_linux
path: dist/*linux*

- name: artifact_darwin
uses: actions/upload-artifact@v2-preview
uses: actions/upload-artifact@v3
with:
name: build_darwin
path: dist/*darwin*

# docker login
- name: docker login
if: github.event.pull_request.head.repo.fork == false
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
Expand All @@ -130,15 +123,15 @@ jobs:
# docker build (latest & tag)
- name: release tag
if: startsWith(github.ref, 'refs/tags/') == true
if: startsWith(github.ref, 'refs/tags/') == true && github.event.pull_request.head.repo.fork == false
uses: little-core-labs/get-git-tag@v3.0.2
id: releasetag
with:
tagRegex: "v?(.+)"

- name: docker - build release
if: startsWith(github.ref, 'refs/tags/') == true
uses: docker/build-push-action@v2
if: startsWith(github.ref, 'refs/tags/') == true && github.event.pull_request.head.repo.fork == false
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
Expand All @@ -153,13 +146,13 @@ jobs:
# docker build (branch)
- name: branch name
if: startsWith(github.ref, 'refs/tags/') == false
if: startsWith(github.ref, 'refs/tags/') == false && github.event.pull_request.head.repo.fork == false
id: branch-name
uses: tj-actions/branch-names@v2.2
uses: tj-actions/branch-names@v6.2

- name: docker tag
if: startsWith(github.ref, 'refs/tags/') == false
uses: frabert/replace-string-action@master
if: startsWith(github.ref, 'refs/tags/') == false && github.event.pull_request.head.repo.fork == false
uses: frabert/replace-string-action@v2.3
id: dockertag
with:
pattern: '[:\.\/]+'
Expand All @@ -168,8 +161,8 @@ jobs:
flags: 'g'

- name: docker - build branch
if: startsWith(github.ref, 'refs/tags/') == false
uses: docker/build-push-action@v2
if: startsWith(github.ref, 'refs/tags/') == false && github.event.pull_request.head.repo.fork == false
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
Expand All @@ -183,5 +176,6 @@ jobs:
# cleanup
- name: cleanup
if: github.event.pull_request.head.repo.fork == false
run: |
rm -f ${HOME}/.docker/config.json

0 comments on commit 94ee31d

Please # to comment.