From b26cc85bf45207f8a656f3280e820f563273227a Mon Sep 17 00:00:00 2001 From: aria Date: Sun, 15 Dec 2024 09:04:32 -0600 Subject: [PATCH] =?UTF-8?q?chore:=20add=20release=20step=20=F0=9F=99=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 92 +++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3abda19 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,92 @@ +name: Manual Release + +on: + workflow_dispatch: + inputs: + version_type: + description: "Version number" + required: true + default: "" + +jobs: + release: + runs-on: ubuntu-latest + + steps: + # Checkout the code + - name: Checkout code + uses: actions/checkout@v3 + + # Setup Node.js environment + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 # or whatever version your project requires + + # Install dependencies + - name: Install dependencies + run: npm ci + + # Run npm version (bump version) + - name: Bump version + id: bump_version + run: | + npm version ${{ github.event.inputs.version_type }} + echo "VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV + + # Push version bump commit and tag + - name: Push version bump and tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push origin HEAD --tags + + # Run the build process + - name: Build for production + run: npm run build + + # Create a new GitHub release + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ env.VERSION }} + release_name: Release v${{ env.VERSION }} + body: | + ## Changes in this release + - TODO: Add release notes here. + draft: false + prerelease: false + + # Upload assets to the release + - name: Upload assets to GitHub Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/main.js + asset_name: main.js + asset_content_type: application/javascript + + - name: Upload styles.css + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/styles.css + asset_name: styles.css + asset_content_type: text/css + + - name: Upload manifest.json + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/manifest.json + asset_name: manifest.json + asset_content_type: application/json