chore: add release action (#143)

* docs: uppercase names of readme files

* cicd: add release action

* cicd: add release-template

* cicd: make release action run on workflow_dispatch

* cicd: test

* No commit message

* cicd: test

* No commit message

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd test

* cicd: test

* cicd: test

* cicd: test

* cicd: test

* cicd: test
This commit is contained in:
xvzc 2024-08-15 13:22:07 +09:00 committed by GitHub
parent 5d0fd16995
commit 884a855a4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 128 additions and 0 deletions

5
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,5 @@
name-template: '$RESOLVED_VERSION'
template: |
## Changes
-
$CONTRIBUTORS

123
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,123 @@
name: Release drafter
on: workflow_dispatch
permissions:
contents: read
jobs:
draft_release:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.release.outputs.tag_name }}
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Read version
id: read_version
run: |
echo "version=$(cat version/VERSION | tr -d '[:space:]')" >> $GITHUB_OUTPUT
- name: Print version
run: |
echo ${{ steps.read_version.outputs.version }}
- uses: release-drafter/release-drafter@v6
id: release
with:
name: ${{ steps.read_version.outputs.version }}
version: ${{ steps.read_version.outputs.version }}
tag: ${{ steps.read_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_and_publish:
runs-on: ubuntu-latest
needs: draft_release
name: Release linux/amd64
permissions:
contents: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ needs.draft_release.outputs.tag_name }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Display Go version
run: go version
- name: darwin/amd64
env:
GOOS: darwin
GOARCH: amd64
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: darwin/arm64
env:
GOOS: darwin
GOARCH: arm64
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: linux/amd64
env:
GOOS: linux
GOARCH: amd64
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: linux/arm
env:
GOOS: linux
GOARCH: arm
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: linux/arm64
env:
GOOS: linux
GOARCH: arm64
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: linux/mips
env:
GOOS: linux
GOARCH: mips
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: linux/mipsle
env:
GOOS: linux
GOARCH: mipsle
run: |
go build -ldflags="-w -s" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
tar -zcvf "spoof-dpi-$GOOS-$GOARCH.tar.gz" ./spoof-dpi && rm -rf ./spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.tar.gz"
- name: windows/amd64
env:
GOOS: windows
GOARCH: amd64
run: |
go build -ldflags="-w -s" -o "spoof-dpi-$GOOS-$GOARCH.exe" github.com/xvzc/SpoofDPI/cmd/spoof-dpi
gh release upload $TAG_NAME "./spoof-dpi-$GOOS-$GOARCH.exe"