Merge branch 'staging' #77
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: | |
push: | |
branches: | |
- main | |
jobs: | |
addon: | |
name: ${{ matrix.config.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
id: "aspect_ratio_resize_container", | |
name: "AspectRatioResizeContainer", | |
} | |
- { | |
id: "custom_theme_overrides", | |
name: "Custom Theme Overrides", | |
} | |
- { | |
id: "git_sha_project_setting", | |
name: "Git SHA Project Setting", | |
} | |
- { | |
id: "glogging", | |
name: "GLogging", | |
} | |
- { | |
id: "hide_private_properties", | |
name: "Hide Private Properties", | |
} | |
- { | |
id: "icon_explorer", | |
name: "Icon Explorer", | |
} | |
- { | |
id: "icons_patcher", | |
name: "Icons Patcher", | |
} | |
- { | |
id: "licenses", | |
name: "License Manager", | |
} | |
- { | |
id: "qr_code", | |
name: "QR Code", | |
} | |
- { | |
id: "texture_button_colored", | |
name: "TextureButtonColored", | |
} | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: Update environment | |
run: | | |
sudo apt update -qq | |
sudo apt install -y golang | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fix git ownership | |
run: | | |
# this is to fix GIT not liking owner of the checkout dir | |
chown -R $(id -u):$(id -g) $PWD | |
- name: Prepare artifacts | |
id: "prepare-artifacts" | |
working-directory: publisher | |
run: | | |
go run . zip -b ../ -a ${{ matrix.config.id }} -o ../archives/ | |
go run . github -b ../ -a ${{ matrix.config.id }} -o $GITHUB_OUTPUT | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.config.name }} | |
path: archives/${{ matrix.config.id }}-*.zip | |
- uses: mukunku/[email protected] | |
id: checkTag | |
with: | |
tag: ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }} | |
- name: Prepare Release | |
if: ${{ steps.checkTag.outputs.exists == 'false' }} | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git tag ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }} | |
git push origin tag ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }} | |
# wait 5s that the pushed tag is available in the next step, sometimes the next step saw only the local tag | |
- name: Wait 5s | |
run: sleep 5s | |
shell: bash | |
- name: Release addon | |
if: ${{ steps.checkTag.outputs.exists == 'false' }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release create ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }} ./archives/* --title "${{ matrix.config.name }} ${{ steps.prepare-artifacts.outputs.version }}" --notes "${{ steps.prepare-artifacts.outputs.notes }}" | |
combined-release: | |
name: Combined Release | |
runs-on: ubuntu-latest | |
needs: | |
- addon | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: archives | |
- name: Prepare Release | |
run: | | |
find archives/ -type f -print0 | xargs -0 mv -t archives | |
git config user.name github-actions | |
git config user.email [email protected] | |
git tag latest | |
git push -f origin tag latest | |
- name: Release | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NOTES: | | |
Providing the latest release of all addons at one place. | |
This release tag is continuously updated. | |
run: | | |
output=$(gh release delete latest -y 2>&1) || [[ "${output}" == "release not found" ]] | |
gh release create latest ./archives/*.zip --latest --title "Latest Release" --notes "${{ env.NOTES }}" --target ${{ github.sha }} |