Skip to content

Commit

Permalink
ci: publish package
Browse files Browse the repository at this point in the history
  • Loading branch information
jusa3 committed Dec 4, 2024
1 parent d07d427 commit f18c73e
Showing 1 changed file with 8 additions and 61 deletions.
69 changes: 8 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Continuous Integration

on:
push:
branches: [main]
branches: [fix/autocomplete-generate-display-label]
pull_request:
workflow_dispatch:
concurrency:
Expand All @@ -14,9 +14,6 @@ jobs:
strategy:
matrix:
node-version: [ 16.x ]
outputs:
srversion: ${{ steps.setoutput.outputs.srversion }}
srrelease: ${{ steps.setoutput.outputs.srrelease }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,72 +34,32 @@ jobs:
run: npm run build --if-present
env:
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }}
- name: Run semantic release and capture output
id: semantic_release
run: |
output=$(npx semantic-release)
sanitized_output=$(echo "$output" | tr '\n' ' ')
echo "release_output=$sanitized_output" >> $GITHUB_OUTPUT
echo "$output"
env:
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
echo "SRVERSION=2.12.2" >> $GITHUB_ENV
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 "actions@github.com"
- 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"
npx gh-pages-multi deploy -s dist_plainjs --no-history -t js-modules/"2.12.2"
documentation:
if: github.ref == 'refs/heads/main' && needs.build.outputs.srrelease == 'release'
needs: build
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -163,24 +120,14 @@ jobs:
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 }}
SRVERSION: 2.12.2
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 }}
SRVERSION: 2.12.2
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"
npx gh-pages-multi deploy -s react --no-history -t react/"2.12.2"
npx gh-pages-multi deploy -s html --no-history -t html/"2.12.2"
npx gh-pages-multi deploy -s public --no-history -t comp/"2.12.2"

0 comments on commit f18c73e

Please sign in to comment.