Skip to content

v1.2.0 release note #20

v1.2.0 release note

v1.2.0 release note #20

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*' # Trigger on tags starting with v, e.g., v1.0.0, v1.0.0-rc.1
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build-binaries:
name: Build Binaries
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Build WebUI
working-directory: ./webui
run: |
npm ci
npm run build
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25.x'
- name: Build Go Binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
VERSION=${GITHUB_REF_NAME}
GIT_COMMIT=${GITHUB_SHA::8}
BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
OUTPUT_NAME=resin-${GOOS}-${GOARCH}
if [ "$GOOS" = "windows" ]; then
OUTPUT_NAME="${OUTPUT_NAME}.exe"
fi
echo "OUTPUT_NAME=${OUTPUT_NAME}" >> $GITHUB_ENV
mkdir -p build
go build -trimpath -tags "with_quic with_wireguard with_grpc with_utls with_embedded_tor with_naive_outbound" \
-ldflags="-s -w \
-X github.com/Resinat/Resin/internal/buildinfo.Version=${VERSION} \
-X github.com/Resinat/Resin/internal/buildinfo.GitCommit=${GIT_COMMIT} \
-X github.com/Resinat/Resin/internal/buildinfo.BuildTime=${BUILD_TIME}" \
-o build/${OUTPUT_NAME} ./cmd/resin
cd build
# Create a copy with the simple name for the archive
SIMPLE_NAME="resin"
if [ "$GOOS" = "windows" ]; then
SIMPLE_NAME="resin.exe"
fi
cp ${OUTPUT_NAME} ${SIMPLE_NAME}
if [ "$GOOS" = "windows" ]; then
zip resin-${GOOS}-${GOARCH}.zip ${SIMPLE_NAME}
PACKAGE_NAME="resin-${GOOS}-${GOARCH}.zip"
else
tar -czvf resin-${GOOS}-${GOARCH}.tar.gz ${SIMPLE_NAME}
PACKAGE_NAME="resin-${GOOS}-${GOARCH}.tar.gz"
fi
# Remove simple name copy to avoid confusion
rm ${SIMPLE_NAME}
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
- name: Upload Release Package Artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
path: build/${{ env.PACKAGE_NAME }}
retention-days: 1
- name: Upload Linux bin for Docker
if: matrix.goos == 'linux'
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.goos }}-${{ matrix.goarch }}
path: build/${{ env.OUTPUT_NAME }}
retention-days: 1
publish-release:
name: Publish Release
runs-on: ubuntu-latest
needs: build-binaries
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Find Release Note
id: release_note
env:
RELEASE_NOTE_PATH: doc/release-notes/${{ github.ref_name }}.md
run: |
if [[ -f "$RELEASE_NOTE_PATH" ]]; then
echo "path=$RELEASE_NOTE_PATH" >> "$GITHUB_OUTPUT"
fi
- name: Download Release Package Artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
path: build
merge-multiple: true
- name: Check if Pre-release
id: check_prerelease
run: |
if [[ "${GITHUB_REF_NAME}" == *"-"* ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Publish Release Assets
uses: softprops/action-gh-release@v2
with:
files: build/*
fail_on_unmatched_files: true
overwrite_files: true
body_path: ${{ steps.release_note.outputs.path }}
generate_release_notes: true
prerelease: ${{ steps.check_prerelease.outputs.is_prerelease == 'true' }}
docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: build-binaries
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Linux amd64 binary
uses: actions/download-artifact@v4
with:
name: binary-linux-amd64
path: release-bin/linux/amd64/
- name: Download Linux arm64 binary
uses: actions/download-artifact@v4
with:
name: binary-linux-arm64
path: release-bin/linux/arm64/
- name: Give binaries execute permission
run: chmod +x release-bin/linux/amd64/resin-linux-amd64 release-bin/linux/arm64/resin-linux-arm64
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check if Pre-release
id: check_prerelease
run: |
if [[ "${GITHUB_REF_NAME}" == *"-"* ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ steps.check_prerelease.outputs.is_prerelease == 'false' }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./.github/Dockerfile.release
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}