Refactored user roles #17404
Workflow file for this run
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
# Copyright 2020 Energinet DataHub A/S | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License2"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Energy Origin CD | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
app-name: app-eo | |
landing-page-app-name: app-eo-landing-page | |
BASE_BRANCH: ${{ github.event.pull_request.base.ref }} | |
is-main-branch: ${{ github.ref == 'refs/heads/main' }} | |
is-pull-request: ${{ github.event_name == 'pull_request' }} | |
# keep in sync with "engines.bun" and "volta.bun" in "package.json" | |
BUN_VERSION: 1.1.26 | |
# Nx Cloud | |
NX_BRANCH: ${{ github.event.number }} | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
NX_RUN_GROUP: ${{ github.run_id }} | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
jobs: | |
affected: | |
name: Is affected? | |
runs-on: ubuntu-latest | |
outputs: | |
is-affected: ${{ steps.affected.outputs.is-affected }} | |
steps: | |
# needed for nx affected command | |
- name: Check out source code with current branch Git history | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# needed for nx affected command | |
- name: "PR: Fetch base branch Git history" | |
if: ${{ env.is-pull-request == 'true' }} | |
run: git fetch --no-tags origin $BASE_BRANCH | |
- name: Bun setup | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: ${{ env.BUN_VERSION }} | |
- name: Install dependencies | |
run: bun install --frozen-lockfile | |
- name: Prepare projects array | |
id: prepare | |
run: echo "projects=[\"${{ env.app-name }}\", \"${{ env.landing-page-app-name }}\"]" >> $GITHUB_OUTPUT | |
- name: Is affected? | |
id: affected | |
uses: ./.github/actions/affected | |
with: | |
base: ${{ env.is-main-branch == 'true' && 'HEAD~1' || format('origin/{0}', env.BASE_BRANCH) }} | |
projects: ${{ steps.prepare.outputs.projects }} | |
app: | |
name: Build app | |
if: ${{ needs.affected.outputs.is-affected == 'true' }} | |
needs: affected | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bun setup | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: ${{ env.BUN_VERSION }} | |
- name: Install dependencies | |
run: bun install --frozen-lockfile | |
- name: Production build | |
run: bun run nx build ${{ env.app-name }} | |
- name: Upload web app build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.app-name }} | |
path: ./dist/apps/eo/ | |
if-no-files-found: error | |
define_build: | |
name: Define build | |
needs: affected | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate version | |
id: version | |
uses: Energinet-DataHub/acorn-actions/actions/docker-image-version@v3 | |
build: | |
runs-on: ubuntu-latest | |
name: Build | |
needs: | |
- define_build | |
- app | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and push container image | |
id: docker_build | |
uses: Energinet-DataHub/acorn-actions/actions/docker-build-and-push@v3 | |
with: | |
dockerfile: build/infrastructure/eo/host/Dockerfile | |
image-name: eo-frontend-app | |
image-tag: ${{ needs.define_build.outputs.version }} | |
update-environment: | |
name: Update environment | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
concurrency: commits-base-environment | |
steps: | |
- name: Update environment | |
uses: Energinet-DataHub/acorn-actions/actions/update-base-environment@v3 | |
with: | |
configuration: build/infrastructure/eo/configuration.yaml | |
deploy_key: ${{ secrets.DEPLOY_KEY_BASE_ENVIRONMENT }} | |
dry_run: ${{ !((github.event_name == 'push' && github.ref_name == 'main') || (github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'preview/')) || (github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'vcluster/'))) }} |