2022-03-15 13:34:14 +02:00
|
|
|
name: 'Production deploy'
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
2022-05-26 17:50:28 +03:00
|
|
|
create-release-tar:
|
2022-05-26 17:47:41 +03:00
|
|
|
name: 'Create release tar'
|
2022-03-15 13:34:14 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-26 17:50:28 +03:00
|
|
|
- name: Checkout repository
|
2022-04-26 14:53:22 +03:00
|
|
|
uses: actions/checkout@v3.0.2
|
2022-06-14 17:25:48 +03:00
|
|
|
- name: Setup node
|
2022-07-16 14:41:48 +03:00
|
|
|
uses: actions/setup-node@v3.4.1
|
2022-06-14 17:25:48 +03:00
|
|
|
with:
|
|
|
|
node-version: 17.9.0
|
2022-05-26 17:47:41 +03:00
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
npm run build
|
2022-03-15 13:34:14 +02: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 14:13:16 +03:00
|
|
|
- name: Sign tar.gz
|
2022-05-26 17:47:41 +03: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 13:34:14 +02:00
|
|
|
- name: Upload tagged release
|
2022-05-01 10:53:42 +03:00
|
|
|
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
|
2022-03-15 13:34:14 +02:00
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
2022-05-03 14:13:16 +03:00
|
|
|
cinny-${{ steps.vars.outputs.tag }}.tar.gz.asc
|
2022-03-15 13:34:14 +02:00
|
|
|
|
2022-05-26 17:47:41 +03:00
|
|
|
deploy-to-netlify:
|
|
|
|
name: 'Deploy to Netlify'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3.0.2
|
2022-06-14 17:25:48 +03:00
|
|
|
- name: Setup node
|
2022-07-16 14:41:48 +03:00
|
|
|
uses: actions/setup-node@v3.4.1
|
2022-06-14 17:25:48 +03:00
|
|
|
with:
|
|
|
|
node-version: 17.9.0
|
2022-05-26 17:47:41 +03:00
|
|
|
- name: Build and deploy to Netlify
|
2022-06-14 17:49:46 +03:00
|
|
|
uses: jsmrcaga/action-netlify-deploy@53de32e559b0b3833615b9788c7a090cd2fddb03
|
2022-05-26 17:47:41 +03:00
|
|
|
with:
|
|
|
|
install_command: "npm ci"
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
|
|
BUILD_DIRECTORY: "dist"
|
|
|
|
NETLIFY_DEPLOY_MESSAGE: "Prod deploy v${{ github.ref }}"
|
|
|
|
NETLIFY_DEPLOY_TO_PROD: true
|
|
|
|
|
2022-05-26 17:50:28 +03:00
|
|
|
push-to-dockerhub:
|
2022-03-15 13:34:14 +02:00
|
|
|
name: Push Docker image to Docker Hub
|
|
|
|
runs-on: ubuntu-latest
|
2022-05-26 17:47:41 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-03-15 13:34:14 +02:00
|
|
|
steps:
|
2022-03-23 16:10:39 +02:00
|
|
|
- name: Checkout repository
|
2022-04-26 14:53:22 +03:00
|
|
|
uses: actions/checkout@v3.0.2
|
2022-05-29 07:45:31 +03:00
|
|
|
- name: Set up QEMU
|
2022-06-04 18:54:43 +03:00
|
|
|
uses: docker/setup-qemu-action@v2.0.0
|
2022-05-29 07:45:31 +03:00
|
|
|
- name: Set up Docker Buildx
|
2022-06-04 18:58:18 +03:00
|
|
|
uses: docker/setup-buildx-action@v2.0.0
|
2022-03-15 13:34:14 +02:00
|
|
|
- name: Login to Docker Hub
|
2022-05-20 07:28:34 +03:00
|
|
|
uses: docker/login-action@v2.0.0
|
2022-03-15 13:34:14 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2022-05-20 07:29:00 +03:00
|
|
|
uses: docker/metadata-action@v4.0.1
|
2022-03-15 13:34:14 +02:00
|
|
|
with:
|
|
|
|
images: ajbura/cinny
|
|
|
|
- name: Build and push Docker image
|
2022-07-27 11:34:59 +03:00
|
|
|
uses: docker/build-push-action@v3.1.0
|
2022-03-15 13:34:14 +02:00
|
|
|
with:
|
|
|
|
context: .
|
2022-05-29 07:45:31 +03:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-03-15 13:34:14 +02:00
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|