Skip to content

Commit

Permalink
update release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
SemProvoost committed Nov 26, 2024
1 parent 0fced4f commit e3870a4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 36 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/release-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release test
on: workflow_dispatch

env:
GO_VERSION: '1.22'

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:

- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false # Disable cache to avoid free space issues during `Post Setup Go` step.


# Create tmp dir for GoReleaser
- name: "create tmp dir"
run: |
mkdir tmp
- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: v2.1.0
args: release -f=${{ inputs.goreleaser_config}} ${{ inputs.goreleaser_options}}
env:
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
TMPDIR: "tmp"

57 changes: 21 additions & 36 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,39 @@ on:
tags:
- "v*"

env:
GO_VERSION: '1.22'

jobs:
release:
name: Release
uses: ./.github/workflows/reusable-release.yaml
with:
goreleaser_config: goreleaser.yml
goreleaser_options: '--clean --timeout 90m'
secrets: inherit

deploy-packages:
name: Deploy rpm/dep packages
needs: release # run this job after 'release' job completes
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:

- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Restore Trivy binaries from cache
uses: actions/[email protected]
- name: Setup Go
uses: actions/setup-go@v5
with:
path: dist/
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}

- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install rpm reprepro createrepo-c distro-info
go-version: ${{ env.GO_VERSION }}
cache: false # Disable cache to avoid free space issues during `Post Setup Go` step.

- name: Checkout trivy-repo
uses: actions/[email protected]
with:
repository: ${{ github.repository_owner }}/trivy-repo
path: trivy-repo
fetch-depth: 0
token: ${{ secrets.ORG_REPO_TOKEN }}

- name: Setup git settings
# Create tmp dir for GoReleaser
- name: "create tmp dir"
run: |
git config --global user.email "[email protected]"
git config --global user.name "Teppei Fukuda"
mkdir tmp
- name: Create rpm repository
run: ci/deploy-rpm.sh

- name: Import GPG key
run: echo -e "${{ secrets.GPG_KEY }}" | gpg --import
- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: v2.1.0
args: release -f=${{ inputs.goreleaser_config}} ${{ inputs.goreleaser_options}}
env:
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
TMPDIR: "tmp"

- name: Create deb repository
run: ci/deploy-deb.sh

0 comments on commit e3870a4

Please sign in to comment.