-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,73 @@ | ||
name: build | ||
|
||
on: | ||
push: { branches: [master, main, dev/*], tags: [v*] } | ||
pull_request: | ||
workflow_dispatch: | ||
push: { branches: [master, main, dev/*], tags: [v*] } | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: { contents: write, packages: write } | ||
|
||
# cancel already in-progress jobs or runs for the current workflow | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: { fetch-depth: 0 } | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: { cache: true, check-latest: true, go-version-file: "go.mod" } | ||
|
||
- name: Run GoReleaser (snapshot) | ||
uses: goreleaser/goreleaser-action@v4 | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
with: | ||
version: latest | ||
args: build --clean --snapshot | ||
env: | ||
REGISTRY: ${{ env.REGISTRY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run GoReleaser (release) | ||
uses: goreleaser/goreleaser-action@v4 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
version: latest | ||
args: release --clean | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: { contents: write, packages: write } | ||
|
||
# cancel already in-progress jobs or runs for the current workflow | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REGISTRY: ${{ env.REGISTRY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | ||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | ||
REGISTRY: ghcr.io | ||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: { fetch-depth: 0 } | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: { cache: true, check-latest: true, go-version-file: "go.mod" } | ||
|
||
- name: Run GoReleaser (snapshot) | ||
uses: goreleaser/goreleaser-action@v4 | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
with: | ||
version: latest | ||
args: build --clean --snapshot | ||
env: | ||
REGISTRY: ${{ env.REGISTRY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run GoReleaser (release) | ||
uses: goreleaser/goreleaser-action@v4 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
version: latest | ||
args: release --clean | ||
env: | ||
REGISTRY: ${{ env.REGISTRY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | ||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: ["1.19", "1.20"] | ||
|
||
steps: | ||
- name: Test with Go | ||
run: go test -json > TestResults-${{ matrix.go-version }}.json | ||
- name: Upload Go test results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Go-results-${{ matrix.go-version }} | ||
path: TestResults-${{ matrix.go-version }}.json |