Skip to content

Commit

Permalink
Build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Elegant996 committed Nov 19, 2023
1 parent 5e4f45c commit 3ffb67b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 12 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: build

permissions: {} # no need any permissions

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 10 * * 1' # run "At 10:00 on Monday"
workflow_call:
inputs:
skipTests:
description: 'Skip tests, useful when there is a dedicated CI job for tests'
default: false
required: false
type: boolean

jobs:
run:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
go: ['stable', 'oldstable']

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
check-latest: true

# - name: Go Format
# run: gofmt -s -w . && git diff --exit-code

- name: Go Vet
run: go vet ./...

- name: Go Tidy
run: go mod tidy && git diff --exit-code

- name: Go Mod
run: go mod download

- name: Go Mod Verify
run: go mod verify
24 changes: 14 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "v*"

env:
CADDY_VERSION: 2.7.4
CADDY_VERSION: 2.7.5

jobs:
docker:
Expand All @@ -21,7 +21,8 @@ jobs:

- name: Get the tag
id: get_tag
run: echo "{TAG}=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
run: |
echo "TAG=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
# - name: Set up QEMU
# run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Expand All @@ -36,19 +37,22 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set image identity
id: image_id
run: echo "{ID}=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
${{ steps.get_tag.outputs.TAG }}-caddy-${{ env.CADDY_VERSION }},
${{ steps.get_tag.outputs.TAG }}
latest
- name: Publish to GitHub Container Registry
- name: Build and push
uses: docker/build-push-action@v5
with:
build-args: |
CADDY_VERSION=${{ env.CADDY_VERSION }}
TAG=${{ steps.get_tag.outputs.TAG }}
context: .
push: true
tags: |
ghcr.io/${{ steps.image_id.outputs.ID }}:${{ steps.get_tag.outputs.TAG }}-caddy-${{ env.CADDY_VERSION }}
ghcr.io/${{ steps.image_id.outputs.ID }}:${{ steps.get_tag.outputs.TAG }}
ghcr.io/${{ steps.image_id.outputs.ID }}:latest
tags: ${{ steps.meta.outputs.tags }}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/Elegant996/scgi-transport
go 1.20

require (
github.com/caddyserver/caddy/v2 v2.7.4
go.uber.org/zap v1.25.0
github.com/caddyserver/caddy/v2 v2.7.5
go.uber.org/zap v1.26.0
)

require (
Expand Down

0 comments on commit 3ffb67b

Please sign in to comment.