Skip to content

Commit

Permalink
ci(test): multiple semantic releases
Browse files Browse the repository at this point in the history
  • Loading branch information
jusa3 committed Feb 6, 2025
1 parent af742b4 commit 7cf84d9
Show file tree
Hide file tree
Showing 4 changed files with 801 additions and 1,299 deletions.
276 changes: 140 additions & 136 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,139 +48,143 @@ jobs:
GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
NODE_AUTH_TOKEN: ${{ secrets.PAT_TO_PUSH }}
SCOPE: '@ts4nfdi'
- name: Capture version number
run: |
echo "SRVERSION=$(echo "${{ steps.semantic_release.outputs.release_output }}" | grep -oP 'Published release \K\d+\.\d+\.\d+')" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
NODE_AUTH_TOKEN: ${{ secrets.PAT_TO_PUSH }}
SCOPE: '@ts4nfdi'
- name: Capture semantic-release
run: |
if echo "${{ steps.semantic_release.outputs.release_output }}" | grep -q 'Published release'; then
echo "SRRELEASE=release" >> $GITHUB_ENV
fi
env:
GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
NODE_AUTH_TOKEN: ${{ secrets.PAT_TO_PUSH }}
SCOPE: '@ts4nfdi'
- name: Set output
id: setoutput
run: |
echo "srversion=$SRVERSION" >> "$GITHUB_OUTPUT"
echo "srrelease=$SRRELEASE" >> "$GITHUB_OUTPUT"
- name: Debug SRVERSION
run: echo "SRVERSION is $SRVERSION"
- name: Debug SRRELEASE
run: echo "SRRELEASE is $SRRELEASE"
- name: Run npm build:plainJS
run: npm run build:plainJS
- name: Set Git Author Identity
if: env.SRRELEASE == 'release'
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Configure Git to Use PAT for Authentication
if: env.SRRELEASE == 'release'
run: |
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n '${{ secrets.GH_PAT }}' | base64)"
- name: Upload artifact
if: env.SRRELEASE == 'release'
uses: actions/upload-pages-artifact@v1
with:
path: dist_plainjs
- name: Copy as Latest to gh-pages
if: env.SRRELEASE == 'release'
run: |
npx gh-pages-multi deploy -s dist_plainjs --no-history -t js-modules/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Copy Version to gh-pages
if: env.SRRELEASE == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx gh-pages-multi deploy -s dist_plainjs --no-history -t js-modules/"$SRVERSION"
documentation:
if: github.ref == 'refs/heads/main' && needs.build.outputs.srrelease == 'release'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com/'
scope: '@zbmed'
token: ${{ secrets.TREEVIEW_SECRET }}
- name: Run npm clean install
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
- name: Run npm build:plainJS
run: npm run build:plainJS
- name: Install and Build HTML Storybook
run: |
npm install
npm run build-storybook-html -- -o html
env:
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
- name: Upload html artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'html'
- name: Install and Build React Storybook
run: |
npm install
npm run build-storybook-react -- -o react
env:
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
- name: Upload react artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'react'
- name: Install and Build Composed Storybook
run: |
npm install
npm run build-storybook -- -o public
env:
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'public'
- name: Set Git Author Identity
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Configure Git to Use PAT for Authentication
run: |
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n '${{ secrets.GH_PAT }}' | base64)"
- name: Use SRVERSION
env:
SRVERSION: ${{ needs.build.outputs.srversion }}
run: echo "SRVERSION is $SRVERSION"
- name: Deploy as Latest to GitHub Pages
if: env.SRVERSION != ''
env:
SRVERSION: ${{ needs.build.outputs.srversion }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx gh-pages-multi deploy -s react --no-history -t react/latest
npx gh-pages-multi deploy -s html --no-history -t html/latest
npx gh-pages-multi deploy -s public --no-history -t comp/latest
- name: Deploy Version to GitHub Pages
if: env.SRVERSION != ''
env:
SRVERSION: ${{ needs.build.outputs.srversion }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx gh-pages-multi deploy -s react --no-history -t react/"$SRVERSION"
npx gh-pages-multi deploy -s html --no-history -t html/"$SRVERSION"
npx gh-pages-multi deploy -s public --no-history -t comp/"$SRVERSION"
GITHUB_NPM_CONFIG_REGISTRY: https://npm.pkg.github.com/
GITHUB_NPM_TOKEN: ${{ secrets.PAT_TO_PUSH }}
PUBLIC_NPM_CONFIG_REGISTRY: https://registry.npmjs.org
PUBLIC_NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
# - name: Capture version number
# run: |
# echo "SRVERSION=$(echo "${{ steps.semantic_release.outputs.release_output }}" | grep -oP 'Published release \K\d+\.\d+\.\d+')" >> $GITHUB_ENV
# env:
# GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
# NODE_AUTH_TOKEN: ${{ secrets.PAT_TO_PUSH }}
# SCOPE: '@ts4nfdi'
# - name: Capture semantic-release
# run: |
# if echo "${{ steps.semantic_release.outputs.release_output }}" | grep -q 'Published release'; then
# echo "SRRELEASE=release" >> $GITHUB_ENV
# fi
# env:
# GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
# NODE_AUTH_TOKEN: ${{ secrets.PAT_TO_PUSH }}
# SCOPE: '@ts4nfdi'
# - name: Set output
# id: setoutput
# run: |
# echo "srversion=$SRVERSION" >> "$GITHUB_OUTPUT"
# echo "srrelease=$SRRELEASE" >> "$GITHUB_OUTPUT"
# - name: Debug SRVERSION
# run: echo "SRVERSION is $SRVERSION"
# - name: Debug SRRELEASE
# run: echo "SRRELEASE is $SRRELEASE"
# - name: Run npm build:plainJS
# run: npm run build:plainJS
# - name: Set Git Author Identity
# if: env.SRRELEASE == 'release'
# run: |
# git config --global user.name "GitHub Actions"
# git config --global user.email "[email protected]"
# - name: Configure Git to Use PAT for Authentication
# if: env.SRRELEASE == 'release'
# run: |
# git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n '${{ secrets.GH_PAT }}' | base64)"
# - name: Upload artifact
# if: env.SRRELEASE == 'release'
# uses: actions/upload-pages-artifact@v1
# with:
# path: dist_plainjs
# - name: Copy as Latest to gh-pages
# if: env.SRRELEASE == 'release'
# run: |
# npx gh-pages-multi deploy -s dist_plainjs --no-history -t js-modules/latest
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Copy Version to gh-pages
# if: env.SRRELEASE == 'release'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# npx gh-pages-multi deploy -s dist_plainjs --no-history -t js-modules/"$SRVERSION"
# documentation:
# if: github.ref == 'refs/heads/main' && needs.build.outputs.srrelease == 'release'
# needs: build
# runs-on: ubuntu-latest
# permissions:
# pages: write # to deploy to Pages
# id-token: write # to verify the deployment originates from an appropriate source
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}
# registry-url: 'https://npm.pkg.github.com/'
# scope: '@zbmed'
# token: ${{ secrets.TREEVIEW_SECRET }}
# - name: Run npm clean install
# run: npm ci
# env:
# NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
# - name: Run npm build:plainJS
# run: npm run build:plainJS
# - name: Install and Build HTML Storybook
# run: |
# npm install
# npm run build-storybook-html -- -o html
# env:
# NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
# - name: Upload html artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: 'html'
# - name: Install and Build React Storybook
# run: |
# npm install
# npm run build-storybook-react -- -o react
# env:
# NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
# - name: Upload react artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: 'react'
# - name: Install and Build Composed Storybook
# run: |
# npm install
# npm run build-storybook -- -o public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: 'public'
# - name: Set Git Author Identity
# run: |
# git config --global user.name "GitHub Actions"
# git config --global user.email "[email protected]"
# - name: Configure Git to Use PAT for Authentication
# run: |
# git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n '${{ secrets.GH_PAT }}' | base64)"
# - name: Use SRVERSION
# env:
# SRVERSION: ${{ needs.build.outputs.srversion }}
# run: echo "SRVERSION is $SRVERSION"
# - name: Deploy as Latest to GitHub Pages
# if: env.SRVERSION != ''
# env:
# SRVERSION: ${{ needs.build.outputs.srversion }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# npx gh-pages-multi deploy -s react --no-history -t react/latest
# npx gh-pages-multi deploy -s html --no-history -t html/latest
# npx gh-pages-multi deploy -s public --no-history -t comp/latest
# - name: Deploy Version to GitHub Pages
# if: env.SRVERSION != ''
# env:
# SRVERSION: ${{ needs.build.outputs.srversion }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# npx gh-pages-multi deploy -s react --no-history -t react/"$SRVERSION"
# npx gh-pages-multi deploy -s html --no-history -t html/"$SRVERSION"
# npx gh-pages-multi deploy -s public --no-history -t comp/"$SRVERSION"
#
6 changes: 5 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
"@semantic-release/github",
"@semantic-release/npm",
[
"@semantic-release/git",
"@amanda-mitchell/semantic-release-npm-multiple",
{
"registries": {
"github": {},
"public": {}
},
"assets": ["package.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
Expand Down
Loading

0 comments on commit 7cf84d9

Please sign in to comment.