-
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.
Merge pull request #21 from cego/staal0-github-actions
Update GitHub Actions
- Loading branch information
Showing
5 changed files
with
77 additions
and
83 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Build | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
cache: false | ||
|
||
- name: Install dependencies | ||
run: go get . | ||
- name: Build | ||
run: go build -ldflags "-X main.Build=${{ github.ref_name }}" -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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Go format | ||
on: [push] | ||
|
||
jobs: | ||
gofmt: | ||
name: format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
- name: gofmt | ||
run: | | ||
gofmt -s -w ./ |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Go Lint | ||
on: [push] | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v4 |
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,39 @@ | ||
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 | ||
release: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.17 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.17 | ||
go-version: "1.21" | ||
cache: false | ||
|
||
- 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/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- 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 |