v0.5.1 #72
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
name: release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
env: | |
GOVERSION: '>=1.21.6' | |
jobs: | |
build-and-run-tests: | |
name: Build & run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
# https://github.com/actions/checkout/tree/v4.1.1 | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Set up Go | |
# https://github.com/actions/setup-go/tree/v4.1.0 | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe | |
with: | |
go-version: ${{ env.GOVERSION }} | |
- name: Generate files | |
run: go generate ./... | |
- name: Build | |
run: go build ./... | |
- name: Run go vet | |
run: go vet ./... | |
- name: Run go tests | |
run: go test -failfast ./... | |
- name: Run go tests (QUIC) | |
run: go test -failfast -tags quic ./... | |
- name: Run go tests (-race) | |
run: go test -race -timeout=5m -failfast ./... | |
- name: Build test docker image | |
run: | | |
touch version.sh | |
docker build -t c2fmzq/tlsproxy:test . | |
docker run --rm --interactive c2fmzq/tlsproxy:test -v | |
create-release: | |
name: Create release | |
needs: build-and-run-tests | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
# https://github.com/actions/checkout/tree/v4.1.1 | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Set up Go | |
# https://github.com/actions/setup-go/tree/v4.1.0 | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe | |
with: | |
go-version: ${{ env.GOVERSION }} | |
- name: Extract release notes | |
run: | | |
./scripts/release-notes.sh "${GITHUB_REF_NAME}" > release-notes.md | |
if [[ $(stat -c %s release-notes.md) == 0 ]]; then | |
echo "No release notes for ${GITHUB_REF_NAME}. Please update CHANGELOG.md" | |
exit 1 | |
fi | |
- name: Build release binaries | |
run: ./scripts/build-release-binaries.sh | |
- name: Create release | |
# https://github.com/softprops/action-gh-release/tree/v0.1.15 | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
draft: false | |
prerelease: ${{ contains(github.ref, '-') }} | |
body_path: release-notes.md | |
fail_on_unmatched_files: true | |
files: bin/* | |
push-to-registry: | |
name: Push image to docker hub | |
needs: | |
- build-and-run-tests | |
- create-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to docker hub | |
# https://github.com/docker/login-action/tree/v3.0.0 | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get release version | |
run: | | |
echo "VERSION=${GITHUB_REF_NAME}" > version.sh | |
echo "BUILD_TAGS='$(echo ${GITHUB_REF_NAME} | sed -re 's/^v[^+]+[+]?//' -e 's/[.]/,/g')'" >> version.sh | |
- name: Set up QEMU | |
# https://github.com/docker/setup-qemu-action/releases/tag/v3.0.0 | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 | |
- name: Set up Docker Buildx | |
# https://github.com/docker/setup-buildx-action/releases/tag/v3.0.0 | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
# https://github.com/docker/metadata-action/releases/tag/v5.0.0 | |
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 | |
with: | |
images: c2fmzq/tlsproxy | |
flavor: ${{ (contains(github.ref, '+') || contains(github.ref, '-')) && 'latest=false' || 'latest=auto' }} | |
- name: Build and push docker image | |
# https://github.com/docker/build-push-action/releases/tag/v5.1.0 | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |