fix(demo): added names #130
This file contains 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: Deploy to cluster | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
build-webpack: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
load: true | |
file: webpack/Dockerfile | |
# TODO: ends with 400 | |
# cache-from: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache | |
# cache-to: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache,mode=max | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: webpack:latest | |
- name: Extract compiled results | |
run: | | |
docker cp $(docker create --name webpack webpack:latest):/usr/src/build/ ./build | |
docker rm webpack | |
- uses: actions/upload-artifact@v3 | |
name: Upload compiled results stats file | |
with: | |
name: webpack-build-stats | |
path: ./build/webpack-stats.json | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v3 | |
name: Upload compiled results | |
with: | |
name: webpack-build | |
path: ./build/ | |
if-no-files-found: error | |
build-web: | |
runs-on: ubuntu-latest | |
needs: | |
- build-webpack | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare image reference | |
run: echo "image_tag=sha-`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
- name: Prepare image metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
${{ secrets.SCW_REGISTRY_ENDPOINT }}/web | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: nologin | |
password: ${{ secrets.SCW_SECRET_KEY }} | |
registry: ${{ secrets.SCW_REGISTRY_ENDPOINT }} | |
- | |
name: Prepare webpack build stats file | |
uses: actions/download-artifact@v3 | |
with: | |
name: webpack-build-stats | |
path: webpack-stats.json | |
- | |
name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: fiesta/Dockerfile | |
load: true | |
# TODO: ends with 400 | |
# cache-from: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache | |
# cache-to: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache,mode=max | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Extract collectstatic results | |
run: | | |
docker cp $(docker create --name web ${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:${{ env.image_tag }}):/usr/src/static/ ./static | |
docker rm web | |
- uses: actions/upload-artifact@v3 | |
name: Upload collectstatic results | |
with: | |
name: web-static | |
path: ./static/ | |
if-no-files-found: error | |
- name: Push image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: fiesta/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-proxy: | |
runs-on: ubuntu-latest | |
needs: | |
- build-webpack | |
- build-web | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare image metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
${{ secrets.SCW_REGISTRY_ENDPOINT }}/proxy | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: nologin | |
password: ${{ secrets.SCW_SECRET_KEY }} | |
registry: ${{ secrets.SCW_REGISTRY_ENDPOINT }} | |
- | |
name: Prepare webpack build files | |
uses: actions/download-artifact@v3 | |
with: | |
name: webpack-build | |
path: webpack-build/ | |
- | |
name: Prepare web static files | |
uses: actions/download-artifact@v3 | |
with: | |
name: web-static | |
path: web-static/ | |
- | |
name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: nginx/proxy.Dockerfile | |
push: true | |
# TODO: ends with 400 | |
# cache-from: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache | |
# cache-to: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache,mode=max | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy: | |
runs-on: ubuntu-latest | |
concurrency: deploy | |
needs: | |
- build-web | |
- build-webpack | |
- build-proxy | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup k8s context | |
run: | | |
echo "${{ secrets.KUBECONFIG }}" > kubeconfig.yaml | |
- name: Prepare image reference | |
run: echo "image_tag=sha-`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
- name: Deploy | |
uses: 'vimeda/[email protected]' | |
with: | |
release: 'fiesta' | |
namespace: 'fiesta' | |
chart: 'charts' | |
token: '${{ github.token }}' | |
timeout: 120s | |
values: >- | |
web: | |
repository: ${{ secrets.SCW_REGISTRY_ENDPOINT }}/web | |
tag: ${{ env.image_tag }} | |
proxy: | |
repository: ${{ secrets.SCW_REGISTRY_ENDPOINT }}/proxy | |
tag: ${{ env.image_tag }} | |
ingress: | |
certContactEmail: ${{ secrets.CERT_CONTACT_EMAIL }} | |
secrets: | |
databaseUrl: ${{ secrets.DATABASE_URL }} | |
s3: | |
keyId: ${{ secrets.S3_KEY_ID }} | |
accessKey: ${{ secrets.S3_ACCESS_KEY }} | |
regionName: ${{ secrets.S3_REGION_NAME }} | |
bucketName: ${{ secrets.S3_BUCKET_NAME }} | |
value-files: >- | |
[ | |
"charts/values.yaml" | |
] | |
env: | |
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}' |