Skip to content

Merge pull request #181 from Yarden-zamir/automaton-testing #57

Merge pull request #181 from Yarden-zamir/automaton-testing

Merge pull request #181 from Yarden-zamir/automaton-testing #57

Workflow file for this run

name: main
on:
push:
tags:
- 'v*'
env:
PROJECT_ID: "518606"
jobs:
modpack-info:
runs-on: ubuntu-latest
outputs:
projectname: ${{ steps.info.outputs.projectname }}
version: ${{ steps.info.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get modpack info
id: info
run: |
manifestjson=`cat ./modpack/manifest.json`
projectname=`echo $(jq -r '.name' <<< "$manifestjson")`
echo "::set-output name=projectname::$projectname"
version=`echo $(jq -r '.minecraft.version' <<< "$manifestjson")`
echo "::set-output name=version::$version"
- name: Get tag
id: version
uses: "WyriHaximus/github-action-get-previous-tag@v1"
changelog:
runs-on: ubuntu-latest
outputs:
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v1.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Write changelog to file
run: echo '${{ steps.changelog.outputs.changelog }}' > CHANGELOG.md
- name: Store changelog
uses: actions/upload-artifact@v2
with:
name: changelog
path: CHANGELOG.md
build:
runs-on: ubuntu-latest
needs: [changelog, modpack-info]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download PAX
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: froehlichA/pax
file: "pax"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download changelog
uses: actions/download-artifact@v2
with:
name: changelog
- name: Move changelog
run: mv ./CHANGELOG.md ./modpack/CHANGELOG.md
- name: Export modpack
run: |
sudo chmod +x ./pax
./pax export
- name: Rename zip
run: |
mv .out/${{ needs.modpack-info.outputs.projectname }}.zip .out/${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
- name: Upload zip
uses: actions/upload-artifact@v2
with:
name: modpack
path: .out/${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
release-github:
runs-on: ubuntu-latest
needs: [build, changelog, modpack-info]
steps:
- name: Download modpack
uses: actions/download-artifact@v2
with:
name: modpack
- name: Download changelog
uses: actions/download-artifact@v2
with:
name: changelog
- name: Create release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: ${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-curseforge:
runs-on: ubuntu-latest
needs: [build, changelog, modpack-info]
steps:
- name: Download modpack
uses: actions/download-artifact@v2
with:
name: modpack
- name: Get release type
id: release-type
run: |
rel_type="release"
case "${{ needs.modpack-info.outputs.tag }}" in
*alpha*) rel_type="alpha" ;;
*beta*) rel_type="beta" ;;
*) rel_type="release" ;;
esac
echo "::set-output name=type::$rel_type"
- name: Create release
uses: itsmeow/curseforge-upload@v3
with:
token: ${{ secrets.CF_API_TOKEN }}
project_id: ${{ env.PROJECT_ID }}
game_endpoint: minecraft
file_path: ${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
changelog: "${{ needs.changelog.outputs.changelog }}"
changelog_type: markdown
game_versions: ${{ needs.modpack-info.outputs.version }}
release_type: ${{ steps.release-type.outputs.type }}