mirror of https://gitlab.com/fscarmen/test.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.3 KiB
71 lines
2.3 KiB
name: Sync WireGuard-go
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '18 2 * * *'
|
|
|
|
jobs:
|
|
WireGuard-go:
|
|
|
|
name: Sync WireGuard-go to the latest
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
env:
|
|
WORKDIR: ./wireguard-go-source
|
|
FILEDIR: wireguard-go
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3.3.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check the official latest version of WireGuard-go
|
|
run: |
|
|
NOW=$(wget -qO- "https://api.github.com/repos/${{ github.repository }}/releases" | grep "tag_name" | grep -i "wireguard-go" | head -n 1 | sed "s/.*_v\(.*\)\".*/\1/g")
|
|
LATEST=$(wget -qO- https://git.zx2c4.com/wireguard-go/ | grep '/wireguard-go/tag' | sed -n 1p | sed "s/.*>\([0-9.]\{1,\}\)<.*/\1/g")
|
|
|
|
if [ "$LATEST" != "$NOW" ]; then
|
|
git clone https://git.zx2c4.com/wireguard-go ${{ env.WORKDIR }}
|
|
cp .github/wireguard-go-releaser.yml ${{ env.WORKDIR }}/.goreleaser.yml
|
|
echo "VERSION=$LATEST" >> $GITHUB_ENV
|
|
echo "flags=--snapshot" >> $GITHUB_ENV
|
|
echo "DATE=$(date "+%Y/%m/%d %H:%M:%S")" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Set up GoReleaser
|
|
uses: actions/setup-go@v4.0.0
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
go-version: "1.20"
|
|
|
|
- name: Cross compile WireGuard-go
|
|
uses: goreleaser/goreleaser-action@v4.2.0
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
distribution: goreleaser
|
|
workdir: ${{ env.WORKDIR }}
|
|
version: latest
|
|
args: release --clean ${{ env.flags }}
|
|
|
|
- name: Move the files and delete temp dir
|
|
if: ${{ env.VERSION != '' }}
|
|
run: |
|
|
[ ! -d ${{ env.FILEDIR }} ] && mkdir -p ${{ env.FILEDIR }}
|
|
cp -f ${{ env.WORKDIR }}/dist/*.tar.gz ${{ env.FILEDIR }}
|
|
rm -rf ${{ env.WORKDIR }}
|
|
|
|
- name: Upload to repository
|
|
uses: stefanzweifel/git-auto-commit-action@v4.16.0
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
commit_message: Sync Wireguard-go to V${{ env.VERSION }} by Github Actions, ${{ env.DATE }}
|
|
|
|
- name: Release binaries
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
tag_name: WireGuard-go_v${{ env.VERSION }}
|
|
files: ${{ env.FILEDIR }}/*.tar.gz
|
|
|