Release 6.1 #2
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: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
release: | |
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Release') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Extract version from PR title | |
id: extract_version | |
run: | | |
VERSION=$(echo "${{ github.event.pull_request.title }}" | sed 's/Release //') | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: Release ${{ env.VERSION }} | |
body: | | |
This is the release description for version ${{ env.VERSION }}. | |
draft: false | |
prerelease: false | |
- name: Create zip file | |
run: | | |
zip -r DGTExtra_datapack_${{ env.VERSION }}.zip data LICENSE pack.mcmeta pack.png README.md | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./DGTExtra_datapack_${{ env.VERSION }}.zip | |
asset_name: DGTExtra_datapack_${{ env.VERSION }}.zip | |
asset_content_type: application/zip |