diff --git a/.github/workflows/get-version.js b/.github/workflows/get-version.js new file mode 100644 index 0000000..f3ef990 --- /dev/null +++ b/.github/workflows/get-version.js @@ -0,0 +1,2 @@ +var fs = require('fs'); +console.log(JSON.parse(fs.readFileSync('module.json', 'utf8')).version); \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8ccc898 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: NENPC CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get Version # Run the script that returns the version from `module.json` + shell: bash + id: get-version + run: echo "::set-output name=version::$(node ./.github/workflows/get-version.js)" + - run: zip -r ./nenpc.zip module.json npc-gen.js css/ data/ lib/ lang/ templates/ # Add folders/files here + - name: Create Release # Create an additional release for this version + id: create_versioned_release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true # set to false if you do not want to allow updates on existing releases + name: Release ${{ steps.get-version.outputs.version }} # Use the version in the name + draft: false + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: './module.json,./nenpc.zip' # don't forget to rename module zip thing + tag: ${{ steps.get-version.outputs.version }} # Use the version as the tag + - name: Create Release + id: create_latest_release + uses: ncipollo/release-action@v1 + if: endsWith(github.ref, 'master') # Only update the latest release when pushing to the master branch + with: + allowUpdates: true + name: Latest + draft: false + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: './module.json,./nenpc.zip' # don't forget to rename module zip thing + tag: latest \ No newline at end of file