-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dennis Staal
committed
Feb 27, 2024
1 parent
4db22c0
commit 94e2507
Showing
2 changed files
with
43 additions
and
76 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,35 +1,23 @@ | ||
name: gofmt | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- '.github/workflows/gofmt.yml' | ||
- '**.go' | ||
name: Go package | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
gofmt: | ||
name: Run gofmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go 1.17 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.17 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-gofmt1.17-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-gofmt1.17- | ||
- name: Install dependencies | ||
run: go get . | ||
- name: Build | ||
run: go build -ldflags "-X main.Build=${{ github.ref_name }}" -v ./... | ||
|
||
- name: gofmt | ||
run: | | ||
gofmt -s -w ./ | ||
# - name: Test | ||
# run: go test -v ./... |
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,62 +1,41 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]*' | ||
release: | ||
types: [created] | ||
|
||
name: Create release and upload binaries | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.17 | ||
uses: actions/setup-go@v5 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.17 | ||
go-version: "1.21" | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: go get . | ||
|
||
- name: Build | ||
run: | | ||
mkdir release | ||
CGO_ENABLED=0 go build -ldflags "-X main.Build=${{ github.ref_name }}" -o release/container-manager | ||
run: CGO_ENABLED=0 go build -ldflags "-X main.Build=${{ github.ref_name }}" | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: latest | ||
path: release | ||
- name: Checksum | ||
run: sha256sum container-manager > SHASUM256.txt | ||
|
||
release: | ||
name: Create and Upload Release | ||
needs: [ build ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Linux artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: latest | ||
path: latest | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload linux-amd64 | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# - name: Test | ||
# run: go test -v ./... | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./latest/container-manager | ||
asset_name: container-manager | ||
asset_content_type: application/octet-stream | ||
files: | | ||
container-manager | ||
SHASUM256.txt | ||
fail_on_unmatched_files: true |