Quote emoji short code #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024 Google LLC | |
# | |
# 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. | |
# This workflow creates a release and builds adifmt binaries for several | |
# platforms whenever a new version tag (v1.2.3) is pushed. | |
name: Create Release | |
env: | |
ACTIONS_RUNNER_DEBUG: true | |
ACTIONS_STEP_LOG: true | |
on: | |
push: | |
tags: | |
- v[0-9]+.* | |
# Builds with the latest Go, regardless of version declared by go.mod, so we | |
# pick up compiler improvements. CI builds with specified version to avoid API | |
# usage regressions. | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.18' | |
cache: true | |
- name: Test | |
run: go test -v ./... | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: ['386', amd64, arm64] | |
exclude: | |
- goarch: '386' | |
goos: darwin | |
include: | |
- goarch: arm | |
goos: linux | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.18' | |
cache: true | |
- name: Build ${{ matrix.goos }} ${{ matrix.goarch }} | |
run: | | |
go build -v -trimpath -o build/ \ | |
-ldflags "-X 'main.version=${{ github.ref_name }}'" \ | |
./adifmt | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.goos }}-${{ matrix.goarch }} | |
path: build/* | |
if-no-files-found: error | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Rename artifacts | |
run: | | |
cd artifacts | |
mkdir files | |
for f in {darwin,linux}-*/* ; do | |
mv "$f" "files/$(basename $f)-$(dirname $f})" | |
done | |
for f in windows-*/* ; do | |
mv "$f" "files/$(basename -s .exe $f)-$(dirname $f}).exe" | |
done | |
- name: Create release ${{ github.ref_name }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: artifacts/files/* | |
prerelease: ${{ contains(github.ref_name, '-') }} | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
append_body: true | |
body: | | |
Download the version below matching your computer's OS and \ | |
processor architecture. Rename the file to `adifmt` or \ | |
`adifmt.exe`, make it executable with `chmod a+x adifmt`, and put \ | |
it somewhere in your `PATH` environment like `~/bin/`. Verify it \ | |
was installed by running `adifmt version`. | |
* macOS users: Download `adifmt-darwin-arm64` for Macs with M1 \ | |
chips or newer. Download `adifmt-darwin-amd64` for older Macs. | |
* Windows users: Download `adifmt-windows-amd64` for most modern \ | |
PCs, `adifmt-windows-arm64` for tablets and other ARM devices, \ | |
and `adifmt-windows-386` for older 32-bit computers. | |
* Linux users: Download `adifmt-linux-arm64` or `adifmt-linux-arm` \ | |
for Raspberry Pi or other embedded/mobile devices. Otherwise, \ | |
download `adifmt-linux-amd64` (64-bit) or `adifmt-linux-386) (32). |