Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: split GHA workflows into separate CI / release #123

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
54 changes: 1 addition & 53 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -49,56 +49,4 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: check

# release:
# permissions:
# # allow goreleaser to access the Releases API
# contents: write
# # Checks if this is a merge into the main and creates a new release if yes.
# if: github.event_name != 'pull_request'
# needs: [test, lint, goreleaser-check]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0

# - name: Restore Go Modules Cache
# uses: actions/cache@v2
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-go-

# - name: Build binary
# run: |
# make build
# chmod +x ./autotag/autotag

# - name: Autotag Merge Commit
# # TODO: replace this with GitHub Action after #41
# run: |
# ./autotag/autotag

# echo "tags:" && git tag -l

# - name: Install rpm
# run: |
# sudo apt-get -qqy update && sudo apt-get -qqy install rpm

# - name: Docker Login
# uses: docker/login-action@v1
# with:
# registry: quay.io
# username: ${{ secrets.QUAY_USER }}
# password: ${{ secrets.QUAY_PASSWD }}

# - name: Deploy Autotag Release
# # TODO(vtopc): switch to the `goreleaser/goreleaser-action` GHA?
# run: |
# curl -sL https://git.io/goreleaser | bash -s -- --parallelism=2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
args: check
68 changes: 68 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: release

on:
push:
branches:
- main
paths:
- go.mod
- go.sum
- '**.go'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write
packages: write

steps:
- name: login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5

- name: Git Config for Unit Tests
run: |
git config --global user.email ci
git config --global user.name ci
git config --global init.defaultBranch main

- name: Run Unit Tests
run: |
make test

- name: Build binary
run: |
make build
chmod +x ./autotag/autotag

- name: Autotag Merge Commit
# TODO: replace this with GitHub Action after #41
run: |
./autotag/autotag

echo "tags:" && git tag -l

- name: Install rpm
run: |
sudo apt-get -qqy update && sudo apt-get -qqy install rpm

- name: Deploy Autotag Release
# TODO(vtopc): switch to the `goreleaser/goreleaser-action` GHA?
run: |
curl -sL https://git.io/goreleaser | bash -s -- --parallelism=2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -105,6 +105,7 @@ archives:
- goos: windows
format: zip

# TODO(joem): multi-arch docker image: https://goreleaser.com/cookbooks/multi-platform-docker-images/
dockers:
- dockerfile: Dockerfile
image_templates: