Skip to content

Commit

Permalink
add CD for all branches
Browse files Browse the repository at this point in the history
  • Loading branch information
axherrm committed Dec 8, 2023
1 parent 62744d2 commit 89506e4
Showing 1 changed file with 53 additions and 20 deletions.
73 changes: 53 additions & 20 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.generate-matrix.outputs.branches }}
json_branches: ${{ steps.generate-matrix.outputs.json_branches }}
artifact_names: ${{ steps.generate-matrix.outputs.artifact_names }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -32,8 +34,15 @@ jobs:
run: |
branches=($(git branch -r | cut -c 3- | sed 's/origin\///g'))
json_branches=$(printf '%s\n' "${branches[@]}" | jq -R . | jq -s -c .)
echo "branches=${json_branches}" >> $GITHUB_OUTPUT
# echo ::set-output name=branches::${json_branches}
echo "branches=${branches}" >> $GITHUB_OUTPUT
echo "json_branches=${json_branches}" >> $GITHUB_OUTPUT
branch_count=$(git branch -r | wc -l)
artifact_names="0"
for ((i = 1; i < $branch_count; i++))
do
artifact_names+=" ${i}"
done
echo "artifact_names=${artifact_names}" >> $GITHUB_OUTPUT
my_echo:
runs-on: ubuntu-latest
Expand All @@ -50,7 +59,7 @@ jobs:
- build_matrix
strategy:
matrix:
branch: ${{ fromJSON(needs.build_matrix.outputs.branches) }}
branch: ${{ fromJSON(needs.build_matrix.outputs.json_branches) }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -65,6 +74,10 @@ jobs:
run: |
npm install
npm run build
- uses: actions/upload-artifact@v3
with:
name: ${{ strategy.job-index }}
path: dist/cv/browser/
# - name: Build
# run: |
# git for-each-ref --shell \
Expand All @@ -73,21 +86,41 @@ jobs:



# 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
deploy:
runs-on: ubuntu-latest
name: Deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs:
- build_matrix
- build
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
# - uses: actions/download-artifact@master
# with:
# name: my-artifact
# path: path/to/artifact

# - name: Download multiple artifacts
# uses: marcofaggian/[email protected]
# with:
# path: ./dist/cv/browser/
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v2
# names: ${{ needs.build_matrix.outputs.artifact_names }}
# paths: ${{ needs.build_matrix.outputs.branches }}
# workflow: continuous-deployment.yml
- run: gh run download $RUN_ID
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_ID: ${{ vars.GITHUB_RUN_ID }}

- run: |
ls -a
- 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

0 comments on commit 89506e4

Please sign in to comment.