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