Merge pull request #81 from TheblueJo/main #174
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: Create new Release | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
if: "startsWith(github.event.head_commit.message, 'v')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: | | |
npm install | |
npm install typescript --save-dev | |
- name: Read version from manifest | |
id: get_version | |
run: | | |
version=$(jq -r '.header.version | map(tostring) | join(".")' manifest.json) | |
echo "Version: $version" | |
echo "version=$version" >> $GITHUB_ENV | |
- name: Create MCPack | |
run: | | |
npx ts-node --project tsconfig.json scripts/build.ts | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: CHANGELOG.md | |
name: "v${{ env.version }}" | |
tag_name: "v${{ env.version }}" | |
files: | | |
PokeBedrock RES ${{ env.version }}.mcpack | |
PokeBedrock RES ${{ env.version }}.zip | |
draft: false | |
- name: Read CHANGELOG.md | |
id: read_changelog | |
run: | | |
changelog=$(cat CHANGELOG.md) | |
echo "changelog<<EOF" >> $GITHUB_ENV | |
echo "$changelog" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Set Release URL | |
id: set_release_url | |
run: echo "release_url=https://github.com/${{ github.repository }}/releases/tag/v${{ env.version }}" >> $GITHUB_ENV | |
- name: Discord Webhook Action | |
uses: tsickert/discord-webhook@v6.0.0 | |
with: | |
avatar-url: "https://cdn.discordapp.com/avatars/1093906253517959248/afcb43ebb982eebca879819dda0ce635.webp" | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
embed-title: "[RES] Update v${{ env.version }}" | |
embed-description: "${{ env.changelog }}" | |
embed-url: "${{ env.release_url }}" | |
filename: "PokeBedrock RES ${{ env.version }}.mcpack" | |
- name: Complete Workflow | |
run: echo "Workflow completed successfully." |