Skip to content

Commit

Permalink
Merge pull request #21 from cego/staal0-github-actions
Browse files Browse the repository at this point in the history
Update GitHub Actions
  • Loading branch information
staal0 authored Feb 28, 2024
2 parents 27fc113 + af8471d commit 1e9d52d
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 83 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
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 ./...
16 changes: 16 additions & 0 deletions .github/workflows/format.yml
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 ./
35 changes: 0 additions & 35 deletions .github/workflows/gofmt.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
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
73 changes: 25 additions & 48 deletions .github/workflows/release.yml
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

0 comments on commit 1e9d52d

Please sign in to comment.