Skip to content

feat: add checksum generator in release #19

feat: add checksum generator in release

feat: add checksum generator in release #19

Workflow file for this run

name: Release
on:
push:
tags: [ v* ]
env:
GO_VERSION: 1.19
REPO: ${{github.repository}}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
GOOS: [linux, darwin, windows]
GOARCH: [amd64, arm64]
include:
- GOOS: windows
ext: .exe
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION}}
- name: Repo Name
id: repo-name
run: echo name=$(basename ${{github.repository}}) >> $GITHUB_OUTPUT
- name: Test
run: go test -v ./...
- name: Build
run: make package PROGRAM=bin/${{env.GOOS}}-${{env.GOARCH}}/${{steps.repo-name.outputs.name}}${{matrix.ext}} PACKAGE=dist/${{steps.repo-name.outputs.name}}-${{env.GOOS}}-${{env.GOARCH}}.zip
env:
GOOS: ${{matrix.GOOS}}
GOARCH: ${{matrix.GOARCH}}
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: dist
retention-days: 1
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs:
- build
- docker-build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Install ChangeLog generator
run: |
wget https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz
tar xzf git-chglog*.tar.gz git-chglog
- name: "Get Last Release"
id: last_release
uses: InsonusK/[email protected]
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
- name: Generate Changelog for ${{ github.ref_name }}
id: generate-changelog
run: PATH="${PATH}:." make CHANGELOG.md
- name: Generate checksum
uses: jmgilman/actions-generate-checksum@v1
with:
patterns: |
./artifacts/kuconf-linux-arm64.zip
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
./artifacts/*
checksum.txt
body_path: ./CHANGELOG.md
draft: false
docker-build:
runs-on: ubuntu-latest
name: Build the docker image
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v2
- name: Build Image
run: make image IMAGE=ghcr.io/${{env.REPO}}:${{ github.ref_name }}
- name: Tag latest
run: docker tag ghcr.io/${{env.REPO}}:${{ github.ref_name }} ghcr.io/${{env.REPO}}:latest
- name: Push
run: docker push ghcr.io/${{env.REPO}}:${{ github.ref_name }}
- name: Push Latest
run: docker push ghcr.io/${{env.REPO}}:latest
# uncomment this if you're also using docker hub
# - name: Login to Docker Container Registry
# if: ${{ secrets.DOCKERHUB_TOKEN }}
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Docker Release to Docker Hub
# if: ${{ secrets.DOCKERHUB_TOKEN }}
# uses: docker/build-push-action@v2
# with:
# context: .
# push: true
# tags: |
# ${{env.REPO}}:latest
# ${{env.REPO}}:${{github.ref_name}}