From 58c1332f64e33814a234be6407f1a8a10ef4fafc Mon Sep 17 00:00:00 2001 From: fynnfluegge Date: Sun, 17 Nov 2024 13:13:07 +0100 Subject: [PATCH] test docker and electron build --- ...uild-pull-request.yaml => build-main.yaml} | 9 ++-- .github/workflows/build-release.yaml | 16 ++++++ .github/workflows/{build.yml => build.yaml} | 6 +-- .github/workflows/{deploy.yml => deploy.yaml} | 9 ++-- .../workflows/electron-build-and-publish.yaml | 49 +++++++++++++++++++ .github/workflows/publish-docker-image.yaml | 8 ++- webapp/package.json | 2 +- 7 files changed, 80 insertions(+), 19 deletions(-) rename .github/workflows/{build-pull-request.yaml => build-main.yaml} (74%) create mode 100644 .github/workflows/build-release.yaml rename .github/workflows/{build.yml => build.yaml} (84%) rename .github/workflows/{deploy.yml => deploy.yaml} (94%) create mode 100644 .github/workflows/electron-build-and-publish.yaml diff --git a/.github/workflows/build-pull-request.yaml b/.github/workflows/build-main.yaml similarity index 74% rename from .github/workflows/build-pull-request.yaml rename to .github/workflows/build-main.yaml index 57a4bcbd..2f914b16 100644 --- a/.github/workflows/build-pull-request.yaml +++ b/.github/workflows/build-main.yaml @@ -1,10 +1,9 @@ - -name: Pull Request Build +name: Main Build on: - pull_request: - branches: [ main ] - + push: + branches: [main] + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 00000000..18bf6611 --- /dev/null +++ b/.github/workflows/build-release.yaml @@ -0,0 +1,16 @@ +name: Release Build + +on: + # push: + # tags: + # - "*.*.*" + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + uses: ./.github/workflows/workflow-build.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yaml similarity index 84% rename from .github/workflows/build.yml rename to .github/workflows/build.yaml index 6b3b0135..e744b8cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yaml @@ -1,9 +1,9 @@ name: Build on: - push: - branches: [ main ] - + pull_request: + branches: [main] + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yaml similarity index 94% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy.yaml index 29d772c8..6b58423a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yaml @@ -2,10 +2,9 @@ name: Deploy on: workflow_run: - workflows: [ Build ] - branches: [ main ] - types: [ completed ] - + workflows: [Main Build] + types: [completed] + concurrency: group: ${{ github.ref }} cancel-in-progress: false @@ -36,7 +35,7 @@ jobs: with: node-version: 18 - - name: Install AWS CDK + - name: Install AWS CDK run: | npm install -g aws-cdk diff --git a/.github/workflows/electron-build-and-publish.yaml b/.github/workflows/electron-build-and-publish.yaml new file mode 100644 index 00000000..2f245987 --- /dev/null +++ b/.github/workflows/electron-build-and-publish.yaml @@ -0,0 +1,49 @@ +name: Electron Build and Publish + +on: + workflow_run: + workflows: [Release Build] + types: [completed] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Build electron app + run: | + cd webapp + npm ci + npm run build-electron + env: + AWS_REGION: ${{ vars.AWS_REGION }} + DOMAIN_NAME: ${{ vars.DOMAIN_NAME }} + API_URL: ${{ vars.API_URL }} + COGNITO_USER_POOL_ID: ${{ vars.COGNITO_USER_POOL_ID }} + COGNITO_APP_CLIENT_ID: ${{ vars.COGNITO_APP_CLIENT_ID }} + REDIRECT_SIGN_IN: ${{ vars.REDIRECT_SIGN_IN }} + REDIRECT_SIGN_OUT: ${{ vars.REDIRECT_SIGN_OUT }} + AUTH_GUARD_REDIRECT: ${{ vars.AUTH_GUARD_REDIRECT }} diff --git a/.github/workflows/publish-docker-image.yaml b/.github/workflows/publish-docker-image.yaml index 1dae6ba1..2450e2c3 100644 --- a/.github/workflows/publish-docker-image.yaml +++ b/.github/workflows/publish-docker-image.yaml @@ -1,9 +1,9 @@ name: Release Build and Push on: - push: - tags: - - "*.*.*" + workflow_run: + workflows: [Release Build] + types: [completed] env: REGISTRY_IMAGE_API: fynnfluegge/rocketnotes-api @@ -47,7 +47,6 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.REGISTRY_IMAGE_API }}:${{ env.RELEASE_TAG }} ${{ env.REGISTRY_IMAGE_API }}:latest - name: Build and push Docker image webapp @@ -57,5 +56,4 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.REGISTRY_IMAGE_WEBAPP }}:${{ env.RELEASE_TAG }} ${{ env.REGISTRY_IMAGE_WEBAPP }}:latest diff --git a/webapp/package.json b/webapp/package.json index 60af65b8..79b976f6 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "webapp", - "version": "1.0.2", + "version": "1.0.0", "main": "electron.js", "scripts": { "ng": "ng",