(Testing Github Actions) Fix output #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Vercel Production Deployment | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Deploy-Production: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Inject API token into vercel config | |
uses: sergeysova/jq-action@v2 | |
id: rewrites | |
with: | |
cmd: jq '.|.rewrites[0].has[0].value="Bearer ${{ secrets.PUB_LYCHEE_KEY }}"|.rewrites[0].destination="${{ secrets.LYCHEE_BASE_URL }}"' vercel.json > tmpvercel.json && mv tmpvercel.json vercel.json | |
- name: Temp Read Vercel Config | |
run: | | |
content=`cat ./path/to/package.json` | |
# the following lines are only required for multi line json (https://stackoverflow.com/a/61919791) | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
# end of optional handling for multi line json | |
echo "::set-output name=packageJson::$content" | |
- run: | | |
echo "${{fromJson(steps.set_var.outputs.packageJson).version}}" | |
- name: Install Vercel CLI | |
run: npm install --global vercel | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy Project Artifacts | |
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} |