Skip to content

Commit

Permalink
fix repository in dispatch payload
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Feb 13, 2024
1 parent f1b2a94 commit 3a44350
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 50 deletions.
97 changes: 49 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,58 @@ name: release
on:
push:
branches:
- main
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: setup eli
uses: alis-is/setup-eli@v1
with:
prerelase: true

- name: build plugins
run: eli tools/build.lua

- name: build plugins
run: |
eli tools/build.lua
- name: create release id
id: prepare_release
run: |
export RELEASE_ID=$(date +'%y%m%d%H%M')
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: check release required
id: check_release_required
env:
RELEASE_ID: ${{steps.prepare_release.outputs.RELEASE_ID}}
run: |
export PAYLOAD=$(eli tools/check-release-required.lua)
echo "PAYLOAD=$PAYLOAD" >> $GITHUB_OUTPUT
- name: Upload files to a GitHub release
uses: svenstaro/[email protected]
if: ${{ steps.check_release_required.outputs.PAYLOAD != '' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{steps.prepare_release.outputs.RELEASE_ID}}
file_glob: true
file: build/*.zip

- name: Air Repository Dispatch
uses: peter-evans/repository-dispatch@v2
if: ${{ steps.check_release_required.outputs.PAYLOAD != '' }}
with:
token: ${{ secrets.AIR_AT }}
repository: alis-is/air
event-type: app-release
client-payload: '${{ steps.check_release_required.outputs.PAYLOAD }}'
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: setup eli
uses: alis-is/setup-eli@v1
with:
prerelase: true

- name: build plugins
run: eli tools/build.lua

- name: build plugins
run: |
eli tools/build.lua
- name: create release id
id: prepare_release
run: |
export RELEASE_ID=$(date +'%y%m%d%H%M')
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: check release required
id: check_release_required
env:
RELEASE_ID: ${{steps.prepare_release.outputs.RELEASE_ID}}
GITHUB_REPOSITORY: ${{github.repository}}
run: |
export PAYLOAD=$(eli tools/check-release-required.lua)
echo "PAYLOAD=$PAYLOAD" >> $GITHUB_OUTPUT
- name: Upload files to a GitHub release
uses: svenstaro/[email protected]
if: ${{ steps.check_release_required.outputs.PAYLOAD != '' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{steps.prepare_release.outputs.RELEASE_ID}}
file_glob: true
file: build/*.zip

- name: Air Repository Dispatch
uses: peter-evans/repository-dispatch@v2
if: ${{ steps.check_release_required.outputs.PAYLOAD != '' }}
with:
token: ${{ secrets.AIR_AT }}
repository: alis-is/air
event-type: app-release
client-payload: '${{ steps.check_release_required.outputs.PAYLOAD }}'
7 changes: 5 additions & 2 deletions tools/check-release-required.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ end))
local versions = string.join(",", table.map(toBeReleased, function(item) return item.version end))
local hashes = string.join(",", table.map(toBeReleased, function(item) return item.sha256 end))

local REPOSITORY = os.getenv("GITHUB_REPOSITORY")

io.write(
string.interpolate(
'{ "id": "${ids}", "repository": "\\${{github.repository}}", "version": "${versions}", "package": "${packages}", "sha256": "${hashes}"}',
'{ "id": "${ids}", "repository": "${repository}", "version": "${versions}", "package": "${packages}", "sha256": "${hashes}"}',
{
ids = ids,
versions = versions,
packages = sources,
hashes = hashes
hashes = hashes,
repository = REPOSITORY
})
)

0 comments on commit 3a44350

Please sign in to comment.