Skip to content

Fix missing release button (#43) #38

Fix missing release button (#43)

Fix missing release button (#43) #38

name: 'Deploy to mod.io'
on:
push:
branches:
- main
jobs:
version:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
latest: ${{ steps.latest.outputs.latest }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Extract version
id: version
run: echo "version=$(jq --raw-output '.version' package.json)" >> "$GITHUB_OUTPUT"
- name: 'Latest released version'
id: latest
run: echo "latest=$(git tag --sort=v:refname | tail -n 1)" >> "$GITHUB_OUTPUT"
- name: Output found versions
run: |
echo "version=${{ steps.version.outputs.version }}"
echo "latest=${{ steps.latest.outputs.latest }}"
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node-setup
- name: Build modfile
run: npm run build --production
- name: Save build mod
uses: actions/upload-artifact@v4
with:
name: item-placeholder
path: item-placeholder.zip
retention-days: 1
deploy:
runs-on: ubuntu-22.04
needs: [version, build]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/download-artifact@v4
with:
name: item-placeholder
- name: 'Build ModIO Changelog'
id: build_modio_changelog
uses: mikepenz/[email protected]
with:
fromTag: ${{ needs.version.outputs.latest }}
configuration: changelog-config.json
toTag: main
fetchViaCommits: true
- name: 'Build Release Changelog'
id: build_changelog
uses: mikepenz/[email protected]
with:
fromTag: ${{ needs.version.outputs.latest }}
toTag: main
fetchViaCommits: true
- name: Create Release
id: create-release
uses: ncipollo/release-action@v1
with:
tag: 'v${{ needs.version.outputs.version }}'
skipIfReleaseExists: true
artifacts: 'item-placeholder.zip'
artifactContentType: application/zip
body: ${{ steps.build_changelog.outputs.changelog }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create changelog temp file
if: steps.create-release.outputs.id
run: echo "${{ steps.build_modio_changelog.outputs.changelog }}" > changelog
- name: Upload to modio
if: steps.create-release.outputs.id
run: |
curl --fail-with-body https://api.mod.io/v1/games/2869/mods/3562687/files \
-H "Authorization: Bearer ${{ secrets.MODIO_TOKEN }}" \
-F "[email protected]" \
-F "version=${{ needs.version.outputs.version }}" \
-F "changelog=<changelog" \
-F "active=true"