name: Production deploy on: workflow_dispatch: jobs: deploy-and-tarball: name: Netlify deploy and tarball outputs: version: ${{ steps.vars.outputs.tag }} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Setup node uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version-file: ".node-version" package-manager-cache: false - name: Install dependencies run: npm ci - name: Run semantic release run: npm run semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} GIT_COMMITTER_NAME: ${{ secrets.GIT_AUTHOR_NAME }} GIT_COMMITTER_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} - name: Get version from tag id: vars run: | TAG=$(git describe --tags --abbrev=0) echo "tag=$TAG" >> $GITHUB_OUTPUT - name: Build app env: NODE_OPTIONS: '--max_old_space_size=4096' run: npm run build - name: Deploy to Netlify uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0 with: publish-dir: dist deploy-message: 'Prod deploy ${{ steps.vars.outputs.tag }}' enable-commit-comment: false github-token: ${{ secrets.GITHUB_TOKEN }} production-deploy: true github-deployment-environment: stable github-deployment-description: 'Stable deployment on each release' env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_APP }} timeout-minutes: 1 - name: Create tar.gz run: tar -czvf cinny-${{ steps.vars.outputs.tag }}.tar.gz dist - name: Sign tar.gz run: | echo '${{ secrets.GNUPG_KEY }}' | gpg --batch --import # Sadly a few lines in the private key match a few lines in the public key, # As a result just --export --armor gives us a few lines replaced with *** # making it useless for importing the signing key. Instead, we dump it as # non-armored and hex-encode it so that its printable. echo "PGP Signing key, in raw PGP format in hex. Import with cat ... | xxd -r -p - | gpg --import" gpg --export | xxd -p echo '${{ secrets.GNUPG_PASSPHRASE }}' | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign cinny-${{ steps.vars.outputs.tag }}.tar.gz - name: Upload tagged release uses: softprops/action-gh-release@6cbd405e2c4e67a21c47fa9e383d020e4e28b836 # v2.3.3 with: tag_name: ${{ steps.vars.outputs.tag }} files: | cinny-${{ steps.vars.outputs.tag }}.tar.gz cinny-${{ steps.vars.outputs.tag }}.tar.gz.asc publish-image: name: Push Docker image to Docker Hub, GHCR needs: deploy-and-tarball env: VERSION: ${{ needs.deploy-and-tarball.outputs.version }} runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - name: Login to Docker Hub #Do not update this action from a outside PR uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to the Github Container registry #Do not update this action from a outside PR uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker, GHCR id: meta uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 with: images: | ${{ secrets.DOCKER_USERNAME }}/cinny ghcr.io/${{ github.repository }} tags: | type=raw,value=${{ env.VERSION }} type=raw,value=latest - name: Build and push Docker image uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}