Skip to content

Commit

Permalink
test release with env
Browse files Browse the repository at this point in the history
  • Loading branch information
sqin2019 committed Sep 21, 2023
1 parent 981847f commit 6d8aa0e
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
name: 'ci'

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
# push:
# branches:
# - 'main'
# pull_request:
# branches:
# - 'main'
workflow_dispatch:

concurrency:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'release'
on:
push:
tags:
- 'v*'

# Don't cancel in progress since we don't want to have half-baked release.
concurrency: '${{ github.workflow }}-${{ github.head_ref || github.ref }}-release'

jobs:
# ci:
# uses: 'abcxyz/access-on-demand/.github/workflows/ci.yml@main' # ratchet:exclude

github-release:
# Run CI before the release
# needs: ['ci']
runs-on: 'ubuntu-latest'
environment: release
permissions:
contents: 'write'
packages: 'write'
steps:
- uses: 'actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8' # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- uses: 'actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f' # ratchet:actions/setup-go@v3
with:
go-version: '1.21'
- uses: 'goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757' # ratchet:goreleaser/goreleaser-action@v3
with:
version: 'v1.16.1' # Manually pinned
args: 'release --clean'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
68 changes: 68 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright 2023 The Authors (see AUTHORS file)

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

env:
# Global env vars for Go build.
- 'CGO_ENABLED=0'
- 'GO111MODULE=on'
- 'GOPROXY=https://proxy.golang.org,direct'

before:
hooks:
- 'go mod tidy'

builds:
-
id: 'aod'
main: './cmd/aod'
binary: 'aod'
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- '-a'
- '-trimpath'
ldflags:
- '-s'
- '-w'
- '-X={{ .ModulePath }}/internal/version.Name=aod'
- '-X={{ .ModulePath }}/internal/version.Version={{ .Version }}'
- '-X={{ .ModulePath }}/internal/version.Commit={{ .Commit }}'
- '-extldflags=-static'
goos:
- 'darwin'
- 'linux'
- 'windows'
goarch:
- 'amd64'
- 'arm64'

archives:
- format: 'tar.gz'
name_template: 'aod_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
format_overrides:
- goos: 'windows'
format: 'zip'

checksum:
name_template: 'aod_{{ .Version }}_SHA512SUMS'
algorithm: 'sha512'


changelog:
use: 'github'
sort: 'asc'

# Release to github.
release:
draft: false
mode: 'replace'

0 comments on commit 6d8aa0e

Please sign in to comment.