2022-12-14 14:17:10 +09:00
|
|
|
name: Production deploy
|
2022-03-15 20:34:14 +09:00
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
2022-09-07 17:16:44 +09:00
|
|
|
deploy-and-tarball:
|
2022-12-14 14:17:10 +09:00
|
|
|
name: Netlify deploy and tarball
|
2022-03-15 20:34:14 +09:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-26 23:50:28 +09:00
|
|
|
- name: Checkout repository
|
2024-04-24 23:32:24 +09:00
|
|
|
uses: actions/checkout@v4.1.3
|
2022-06-14 23:25:48 +09:00
|
|
|
- name: Setup node
|
2024-04-25 21:56:29 +09:00
|
|
|
uses: actions/setup-node@v4.0.2
|
2022-06-14 23:25:48 +09:00
|
|
|
with:
|
2024-04-24 23:31:01 +09:00
|
|
|
node-version: 20.12.2
|
|
|
|
cache: 'npm'
|
2022-09-07 17:16:44 +09:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Build app
|
2023-03-29 12:17:00 +09:00
|
|
|
env:
|
2024-04-24 23:31:01 +09:00
|
|
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
2022-09-07 17:16:44 +09:00
|
|
|
run: npm run build
|
|
|
|
- name: Deploy to Netlify
|
2023-10-23 20:05:38 +09:00
|
|
|
uses: nwtgck/actions-netlify@7a92f00dde8c92a5a9e8385ec2919775f7647352
|
2022-09-07 17:16:44 +09:00
|
|
|
with:
|
|
|
|
publish-dir: dist
|
2024-04-24 23:31:01 +09:00
|
|
|
deploy-message: 'Prod deploy ${{ github.ref_name }}'
|
2022-09-07 17:16:44 +09:00
|
|
|
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 }}
|
2022-12-14 14:17:10 +09:00
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_APP }}
|
2022-09-07 17:16:44 +09:00
|
|
|
timeout-minutes: 1
|
2022-03-15 20:34:14 +09:00
|
|
|
- name: Get version from tag
|
|
|
|
id: vars
|
2023-01-30 13:46:56 +09:00
|
|
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
2022-03-15 20:34:14 +09:00
|
|
|
- name: Create tar.gz
|
|
|
|
run: tar -czvf cinny-${{ steps.vars.outputs.tag }}.tar.gz dist
|
2022-05-03 20:13:16 +09:00
|
|
|
- name: Sign tar.gz
|
2022-05-26 23:47:41 +09:00
|
|
|
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
|
2022-03-15 20:34:14 +09:00
|
|
|
- name: Upload tagged release
|
2022-12-06 16:18:17 +09:00
|
|
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
2022-03-15 20:34:14 +09:00
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
2022-05-03 20:13:16 +09:00
|
|
|
cinny-${{ steps.vars.outputs.tag }}.tar.gz.asc
|
2022-03-15 20:34:14 +09:00
|
|
|
|
2022-09-07 17:16:44 +09:00
|
|
|
publish-image:
|
2022-08-21 00:29:02 +09:00
|
|
|
name: Push Docker image to Docker Hub, ghcr
|
2022-03-15 20:34:14 +09:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-26 23:47:41 +09:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-08-21 00:29:02 +09:00
|
|
|
packages: write
|
2022-03-15 20:34:14 +09:00
|
|
|
steps:
|
2022-03-23 23:10:39 +09:00
|
|
|
- name: Checkout repository
|
2024-04-24 23:32:24 +09:00
|
|
|
uses: actions/checkout@v4.1.3
|
2022-05-29 13:45:31 +09:00
|
|
|
- name: Set up QEMU
|
2024-04-25 21:28:46 +09:00
|
|
|
uses: docker/setup-qemu-action@v3.0.0
|
2022-05-29 13:45:31 +09:00
|
|
|
- name: Set up Docker Buildx
|
2023-06-20 08:10:12 +09:00
|
|
|
uses: docker/setup-buildx-action@v2.7.0
|
2022-03-15 20:34:14 +09:00
|
|
|
- name: Login to Docker Hub
|
2024-04-25 21:30:16 +09:00
|
|
|
uses: docker/login-action@v3.1.0
|
2022-03-15 20:34:14 +09:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2022-08-21 00:29:02 +09:00
|
|
|
- name: Login to the Container registry
|
2024-04-25 21:30:16 +09:00
|
|
|
uses: docker/login-action@v3.1.0
|
2022-08-21 00:29:02 +09:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-15 20:34:14 +09:00
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2024-04-25 21:31:41 +09:00
|
|
|
uses: docker/metadata-action@v5.5.1
|
2022-03-15 20:34:14 +09:00
|
|
|
with:
|
2022-08-21 00:29:02 +09:00
|
|
|
images: |
|
|
|
|
${{ secrets.DOCKER_USERNAME }}/cinny
|
|
|
|
ghcr.io/${{ github.repository }}
|
2022-03-15 20:34:14 +09:00
|
|
|
- name: Build and push Docker image
|
2023-06-20 08:08:37 +09:00
|
|
|
uses: docker/build-push-action@v4.1.1
|
2022-03-15 20:34:14 +09:00
|
|
|
with:
|
|
|
|
context: .
|
2022-05-29 13:45:31 +09:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-03-15 20:34:14 +09:00
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|