Skip to content

Commit

Permalink
ci(deploy-pages): use env variables to provide auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
danielleroux committed Jun 1, 2023
1 parent b2f2b47 commit 9a37cff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 33 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
filter: # id of input
description: 'yarn filter property'
default: 'none'

args: # id of input
description: 'additional args'
default: ''
runs:
using: 'composite'
steps:
Expand All @@ -26,12 +30,12 @@ runs:
- name: build with filter
if: ${{ inputs.filter != 'none' }}
run: yarn build --filter ${{ inputs.filter }}
run: yarn build --filter ${{ inputs.filter }} ${{ inputs.args }}
shell: bash

- name: build all
if: ${{ inputs.filter == 'none' }}
run: yarn build
run: yarn build ${{ inputs.args }}
shell: bash

- name: Check for local development changes
Expand Down
50 changes: 19 additions & 31 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,53 +39,41 @@ jobs:
run: |
apt-get update && apt-get install -y rsync
- uses: ./.github/workflows/actions/install

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://code.siemens.com/api/v4/projects/249177/packages/npm/'
scope: '@siemens'
always-auth: 'true'

- name: 'Download and link @siemens/ix-brand-theme'
env:
NODE_AUTH_TOKEN: ${{ secrets.READ_CSC_TOKEN }}
NPM_TOKEN: ${{ secrets.READ_CSC_TOKEN }}
run: |
mkdir .tmp-brand
cd .tmp-brand
echo "@siemens:registry=https://code.siemens.com/api/v4/projects/249177/packages/npm/" >> .npmrc
echo "//code.siemens.com/api/v4/projects/249177/packages/npm/:_authToken=${{ secrets.READ_CSC_TOKEN }}" >> .npmrc
npm install @siemens/ix-brand-theme@^1.1.0 --no-save --legacy-peer-deps
cd ./node_modules/@siemens/ix-icons
yarn link
- uses: ./.github/workflows/actions/install
- name: 'Build documentation for prod instance'
- name: 'Build documentation for dev instance'
uses: ./.github/workflows/actions/build
if: ${{ github.event.inputs.deployment == 'dev' }}
env:
BASE_URL: /version-dev/
with:
filter: 'documentation'
args: '--force'

- name: 'Build documentation for prod instance'
uses: ./.github/workflows/actions/build
if: ${{ github.event.inputs.deployment == 'prod' }}
env:
BASE_URL: /
with:
filter: 'documentation'

# - name: 'Download @siemens/ix-brand-theme'
# run: |
# rm .yarnrc
# ROOT=$(pwd)
# echo "@siemens:registry=https://code.siemens.com/api/v4/projects/249177/packages/npm/" >> .npmrc
# echo "//code.siemens.com/api/v4/projects/249177/packages/npm/:_authToken=${{ secrets.READ_CSC_TOKEN }}" >> .npmrc
# npm install @siemens/ix-brand-theme@^1.1.0 --no-save --legacy-peer-deps
# rm .npmrc
# cp -R ./node_modules/@siemens/ix-brand-theme ./packages/html-test-app/src/public/additional-theme
# sed -i -e '/\"publishConfig\"/,/}/ d; /^$/d' ./packages/html-test-app/src/public/additional-theme/ix-brand-theme/package.json
# rm ./packages/html-test-app/src/public/additional-theme/ix-brand-theme/package.json-e || true

# - name: 'Build documentation for dev instance'
# if: ${{ github.event.inputs.deployment == 'dev' }}
# run: |
# yarn workspace @siemens/html-test-app run build
# BASE_URL=/version-dev/ yarn workspace documentation run build

# - name: 'Build documentation for prod instance'
# if: ${{ github.event.inputs.deployment == 'prod' }}
# run: |
# yarn workspace @siemens/html-test-app run build
# BASE_URL=/ yarn workspace documentation run build
args: '--force'

- name: Deploy production instance 🚀
uses: JamesIves/github-pages-deploy-action@v4
Expand Down

0 comments on commit 9a37cff

Please sign in to comment.