From f29a6149720a907feebceba5ab5b1b9d8312418c Mon Sep 17 00:00:00 2001 From: axherrm Date: Fri, 8 Dec 2023 21:04:49 +0100 Subject: [PATCH] add CD for all branches --- .github/workflows/continuous-deployment.yml | 100 ++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/continuous-deployment.yml diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml new file mode 100644 index 0000000..2f017d4 --- /dev/null +++ b/.github/workflows/continuous-deployment.yml @@ -0,0 +1,100 @@ +name: Continous Deployment + +on: + push: + branches: + - "**" + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build_matrix: + runs-on: ubuntu-latest + outputs: + branches: ${{ steps.generate-matrix.outputs.branches }} +# versions: ${{ steps.generate-matrix.outputs.versions }} + steps: + - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 + - name: Generate Matrix + id: generate-matrix + run: | + apt-get update + apt-get install -y jq + branches=($(git branch | cut -c 3-)) + json_branches=$(printf '%s\n' "${branches[@]}" | jq -R . | jq -s -c .) +# json_branches=$(toJSON "${branches[@]}") + echo ::set-output name=branches::${json_branches} + # SERVICES='${{ toJSON(github.event.client_payload.services) }}' +# echo ::set-output name=services::${SERVICES} +# VERSIONS='${{ toJSON(github.event.client_payload.versions) }}' +# echo ::set-output name=versions::${VERSIONS} + # ------------------------ + my_echo: + runs-on: ubuntu-latest + needs: + - build_matrix + steps: + - name: Echo previous outputs + run: echo "${{ toJSON(needs.build_matrix.outputs) }}" + + build: + runs-on: ubuntu-latest + name: Build + needs: + - build_matrix + strategy: + matrix: + branch: ${{ fromJSON(needs.build_matrix.outputs.branches) }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + # with: +# fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + # Version Spec of the version to use in SemVer notation. + # It also emits such aliases as lts, latest, nightly and canary builds + # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node + node-version: 20 + - name: Build + run: | + npm install + npm run build +# - name: Build +# run: | +# git for-each-ref --shell \ +# --format='git checkout \ +# refs/heads/ + + + +# deploy: +# runs-on: ubuntu-latest +# name: Deploy +# environment: +# name: github-pages +# url: ${{ steps.deployment.outputs.page_url }} +# needs: +# - build +# steps: +# - name: Setup Pages +# uses: actions/configure-pages@v3 +# - name: Upload artifact +# uses: actions/upload-pages-artifact@v2 +# with: +# path: ./dist/cv/browser/ +# - name: Deploy to GitHub Pages +# id: deployment +# uses: actions/deploy-pages@v2