Skip to content

Commit

Permalink
add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lincyaw committed Jun 18, 2024
1 parent 241cf3b commit a022c6b
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ jobs:
PLATFORM=${{ matrix.platform }}
OS=$(echo $PLATFORM | cut -d'/' -f1)
ARCH=$(echo $PLATFORM | cut -d'/' -f2)
ARTIFACT_NAME=$(echo $PLATFORM | tr '/' '_')
echo "OS=$OS" >> $GITHUB_ENV
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
- name: Build for ${{ matrix.platform }}
run: |
Expand All @@ -41,33 +43,40 @@ jobs:
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-build
name: ${{ env.ARTIFACT_NAME }}-build
path: build/

- name: Clean build directory
run: make clean
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
path: build/

- name: Create new tag
id: create_tag
env:
GH_TOKEN: ${{ secrets.MYGITHUB_TOKEN }}
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
NEW_TAG="${TIMESTAMP}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag $NEW_TAG
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git $NEW_TAG
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
- name: Display structure of downloaded files
run: ls -R
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
files: |
build/vpn-tool_windows_amd64.exe
build/vpn-tool_windows_arm64.exe
build/vpn-tool_linux_amd64
build/vpn-tool_linux_arm64
build/vpn-tool_darwin_amd64
build/vpn-tool_darwin_arm64
tag_name: ${{ env.NEW_TAG }}
files: build/*/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.MYGITHUB_TOKEN }}

0 comments on commit a022c6b

Please sign in to comment.