chore: Updated integration fixtures #203
Workflow file for this run
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
# Version tags only | |
name: Publish | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
jobs: | |
prePublishPackageTest: | |
name: Prepublish package test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Retrieve dependencies from cache | |
uses: actions/cache@v2 | |
id: cacheNpm | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
if: steps.cacheNpm.outputs.cache-hit != 'true' | |
run: | | |
npm update --no-save | |
npm update --save-dev --no-save | |
- name: Build local package | |
run: npm pack | |
- name: Run tests against version packaged with npm pack | |
run: | | |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n")) | |
TAG=${TEMP_ARRAY[@]: -1} | |
PACKAGE_VERSION=${TAG:1} | |
mkdir "serverless-${PACKAGE_VERSION}" | |
tar zxf "serverless-${PACKAGE_VERSION}.tgz" -C "serverless-${PACKAGE_VERSION}" | |
cp -R test "serverless-${PACKAGE_VERSION}/package" | |
ln -s "$(pwd)"/node_modules "serverless-${PACKAGE_VERSION}/package/node_modules" | |
cd "serverless-${PACKAGE_VERSION}/package" | |
script -e -c "npm test -- -b" | |
npmPublish: | |
name: Publish to npm | |
needs: prePublishPackageTest | |
runs-on: ubuntu-latest | |
env: | |
# It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally) | |
# Still then release author would be "github-actions". It's better if it's dedicated repo bot | |
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Retrieve dependencies from cache | |
uses: actions/cache@v2 | |
id: cacheNpm | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v16-${{ runner.os }}-refs/heads/v2-${{ hashFiles('package.json') }} | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
if: steps.cacheNpm.outputs.cache-hit != 'true' | |
run: | | |
npm update --no-save | |
npm update --save-dev --no-save | |
- name: Publish new version | |
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work | |
# as it appears actions/setup-node sets own value | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish --tag latest-2 | |
- name: Build standalone artifacts | |
run: npm run pkg:build | |
- name: Publish release notes | |
run: | | |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n")) | |
TAG=${TEMP_ARRAY[@]: -1} | |
npx github-release-from-cc-changelog $TAG | |
- name: Publish standalone artifacts | |
env: | |
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} | |
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} | |
run: | | |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n")) | |
TAG=${TEMP_ARRAY[@]: -1} | |
npm run pkg:upload -- $TAG --legacy | |
chocoPublish: | |
name: Publish to Chocolatey | |
needs: npmPublish | |
runs-on: windows-latest | |
env: | |
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Retrieve dependencies from cache | |
uses: actions/cache@v2 | |
id: cacheNpm | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v16-${{ runner.os }}-refs/heads/v2-${{ hashFiles('package.json') }} | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
if: steps.cacheNpm.outputs.cache-hit != 'true' | |
run: | | |
npm update --no-save | |
npm update --save-dev --no-save | |
- name: Publish to Chocolatey | |
shell: bash | |
run: | | |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n")) | |
TAG=${TEMP_ARRAY[@]: -1} | |
cd `npm run pkg:generate-choco-package $TAG | tail -1` | |
choco apikey --key $CHOCO_API_KEY --source https://push.chocolatey.org/ | |
choco pack | |
choco push serverless.${TAG:1}.nupkg |