Release #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
build-artifact-name: build-artifact | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: leafo/gh-actions-lua@v10 | |
with: | |
lua-version: 5.4 | |
- name: Build | |
run: | | |
make clean | |
make build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.build-artifact-name }} | |
path: dist | |
retention-days: 1 | |
overwrite: true | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
strategy: | |
matrix: | |
target: | |
- '{ | |
"name": "psd", | |
"output": "./dist/Export as psd.lua" | |
}' | |
- '{ | |
"name": "icon-and-cursor", | |
"output": "./dist/Export as ico cur ani.lua" | |
}' | |
- '{ | |
"name": "lcd-pixel-filter", | |
"output": "./dist/LCD Pixel Filter.lua" | |
}' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.build-artifact-name }} | |
path: dist | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/use-script-manifest | |
id: manifest | |
with: | |
filename: ${{ fromJSON(matrix.target).output }} | |
- name: Set env | |
env: | |
NAME: ${{ steps.manifest.outputs.name }} | |
VERSION: ${{ steps.manifest.outputs.version }} | |
run: | | |
TAG_NAME="${NAME##*/}-$VERSION" | |
RELEASE_NAME="Release ${NAME##*/} $VERSION" | |
echo "tag-name=$TAG_NAME" >> $GITHUB_ENV | |
echo "release-name=$RELEASE_NAME" >> $GITHUB_ENV | |
- name: Check if tag exists | |
id: tag-check | |
run: | | |
if git tag | grep "${{ env.tag-name }}"; then | |
echo "::debug::Tag ${{ env.tag-name }} exits." | |
echo "exists=1" >> $GITHUB_OUTPUT | |
else | |
echo "::debug::Tag ${{ env.tag-name }} does not exist." | |
echo "exists=0" >> $GITHUB_OUTPUT | |
fi | |
- name: Create tag | |
if: ${{ steps.tag-check.outputs.exists == 0 }} | |
run: | | |
git tag ${{ env.tag-name }} | |
git push origin ${{ env.tag-name }} | |
- name: Create Release | |
if: ${{ steps.tag-check.outputs.exists == 0 }} | |
env: | |
FILENAME: ${{ fromJSON(matrix.target).output }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release create "${{ env.tag-name }}" -t "${{ env.release-name }}" | |
deploy-pages: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: ${{ env.build-artifact-name }} |