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
|
|
USERNAME: ${{ secrets.GH_USERNAME }}
|
|
EMAIL: ${{ secrets.GH_EMAIL }}
|
|
|
|
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/${{ env.USERNAME }}/warp/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
|
|
fi
|
|
|
|
- name: Set up GoReleaser
|
|
uses: actions/setup-go@v3
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
go-version: "1.18"
|
|
|
|
- name: Cross compile WireGuard-go
|
|
uses: goreleaser/goreleaser-action@v4
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
distribution: goreleaser
|
|
workdir: ${{ env.WORKDIR }}
|
|
version: "1.18"
|
|
args: release --clean ${{ env.flags }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
|
|
- name: Release binaries
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ env.VERSION != '' }}
|
|
with:
|
|
tag_name: WireGuard-go_v${{ env.VERSION }}
|
|
files: ${{ env.WORKDIR }}/dist/*.tar.gz
|
|
|
|
- name: Upload to REPO
|
|
if: ${{ env.VERSION != '' }}
|
|
run: |
|
|
cp -f ${{ env.WORKDIR }}/dist/*.tar.gz ${GITHUB_WORKSPACE}/wireguard-go/
|
|
rm -rf ${{ env.WORKDIR }}
|
|
git config --global user.email "${{ env.EMAIL }}"
|
|
git config --global user.name "${{ env.USERNAME }}"
|
|
git add .
|
|
git commit -m "Wireguard-go V${{ env.VERSION }}, $(date "+%Y/%m/%d")"
|
|
git push
|
|
|