Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release action #142

Merged
merged 37 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name-template: '$RESOLVED_VERSION'
template: |
## Changes
-
$CONTRIBUTORS
8 changes: 0 additions & 8 deletions .github/release-template.yaml

This file was deleted.

133 changes: 105 additions & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,117 @@ permissions:

jobs:
draft_release:
permissions:
contents: write
pull-requests: write

runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.release.outputs.tag_name }}
permissions:
contents: write
pull-requests: write
steps:
- uses: release-drafter/release-drafter@v5
- 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:
config-name: release-template.yaml
version: v1.1.1
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:
# needs: draft_release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python 3.10
# uses: actions/setup-python@v3
# with:
# python-version: "3.10"
# - name: Initialize build environment
# run: |
# python -m pip install -r requirements.txt
# - name: Build pakage
# env:
# BOJ_CLI_NEXT_VERSION: ${{ needs.draft_release.outputs.tag_name }}
# run: |
# python setup.py sdist bdist_wheel
# - name: Publish to pypi
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_API_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"

Loading