Compare commits
24
Commits
@@ -1,9 +1,14 @@
|
|||||||
name: Create Release on Tag
|
name: Create Release on Tag
|
||||||
# on: [workflow_dispatch]
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
tag_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate-config:
|
generate-config:
|
||||||
@@ -21,7 +26,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Get OpenWRT version from tag
|
- name: Get OpenWRT version from tag
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" == "workflow_call" ]; then
|
||||||
|
echo "VERSION=${{ inputs.tag_name }}" >> $GITHUB_ENV
|
||||||
|
echo "VERSION=${VERSION#v}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
sync-releases:
|
sync-releases:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
release_exists: ${{ steps.check_release.outputs.release_exists }}
|
||||||
|
release_tag: ${{ steps.get_release.outputs.release_tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout your repo
|
- name: Checkout your repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -24,12 +27,18 @@ jobs:
|
|||||||
- name: Check if release exists in your repo
|
- name: Check if release exists in your repo
|
||||||
id: check_release
|
id: check_release
|
||||||
run: |
|
run: |
|
||||||
curl -s https://api.github.com/repos/Slava-Shchipunov/awg-openwrt/releases/tags/${{ steps.get_release.outputs.release_tag }} | jq -r .tag_name || echo "Not found"
|
RELEASE_EXISTS=$(curl -s https://api.github.com/repos/Slava-Shchipunov/awg-openwrt/releases/tags/${{ steps.get_release.outputs.release_tag }} | jq -r .tag_name)
|
||||||
|
if [ "$RELEASE_EXISTS" == "null" ]; then
|
||||||
|
echo "::set-output name=release_exists::false"
|
||||||
|
else
|
||||||
|
echo "::set-output name=release_exists::true"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Create release in your repo
|
- name: Create release in your repo
|
||||||
if: steps.check_release.outputs.tag_name == 'Not found'
|
if: steps.check_release.outputs.release_exists == 'false'
|
||||||
run: |
|
run: |
|
||||||
ART="
|
ART="
|
||||||
|
\`\`\`
|
||||||
_______ ________ __
|
_______ ________ __
|
||||||
| |.-----.-----.-----.| | | |.----.| |_
|
| |.-----.-----.-----.| | | |.----.| |_
|
||||||
| - || _ | -__| || | | || _|| _|
|
| - || _ | -__| || | | || _|| _|
|
||||||
@@ -37,12 +46,21 @@ jobs:
|
|||||||
|__| A M N E Z I A W I R E G U A R D
|
|__| A M N E Z I A W I R E G U A R D
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
OpenWrt ${{ steps.get_release.outputs.release_tag }}
|
OpenWrt ${{ steps.get_release.outputs.release_tag }}
|
||||||
-----------------------------------------------------"
|
-----------------------------------------------------
|
||||||
|
\`\`\`"
|
||||||
|
|
||||||
curl -X POST https://api.github.com/repos/Slava-Shchipunov/awg-openwrt/releases \
|
curl -X POST https://api.github.com/repos/Slava-Shchipunov/awg-openwrt/releases \
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d "$(jq -n --arg tag "${{ steps.get_release.outputs.release_tag }}" \
|
||||||
"tag_name": "'${{ steps.get_release.outputs.release_tag }}'",
|
--arg name "Build amnezia wg for all devices with openwrt ${{ steps.get_release.outputs.release_tag }}" \
|
||||||
"name": "Build amnezia wg for all devices with openwrt '${{ steps.get_release.outputs.release_tag }}'",
|
--arg body "$ART" \
|
||||||
"body": "'"${ART}"'\n\nAutomatically created release for OpenWRT '${{ steps.get_release.outputs.release_tag }}'."
|
'{ tag_name: $tag, name: $name, body: $body }')"
|
||||||
}'
|
|
||||||
|
run-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: sync-releases
|
||||||
|
if: needs.sync-releases.outputs.release_exists == 'false'
|
||||||
|
uses: Slava-Shchipunov/awg-openwrt/.github/workflows/build-module.yml@master
|
||||||
|
with:
|
||||||
|
tag_name: ${{ needs.sync-releases.outputs.release_tag }}
|
||||||
Reference in New Issue
Block a user