Release #16
This file contains hidden or 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: workflow_dispatch | |
| permissions: | |
| contents: read # for checkout | |
| packages: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: v22.12.0 | |
| - name: Create .npmrc | |
| run: | | |
| echo "@OrdinarySMP:registry=https://npm.pkg.github.com" > .npmrc | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run build | |
| run: yarn build | |
| - name: Upload the .output folder | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: output | |
| path: .output | |
| release: | |
| name: Release | |
| if: github.ref == 'refs/heads/main' | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| outputs: | |
| version: ${{ steps.semantic-release.outputs.new_release_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Semantic Release | |
| uses: cycjimmy/semantic-release-action@v4 | |
| id: semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| push_to_registry: | |
| name: Push Docker image to Docker Hub | |
| needs: release | |
| if: needs.release.outputs.version != '' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Download the .output folder | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: output | |
| path: ./.output | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: padbro/ordinary-helper-panel | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| padbro/ordinary-helper-panel:latest | |
| padbro/ordinary-helper-panel:v${{ needs.release.outputs.version }} | |
| labels: ${{ steps.meta.outputs.labels }} |