@aliceo2/[email protected] #124
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
name: release | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
deploy-npm-module: | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION: ${{ steps.set-project.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Check released tag matches ALICE O2 naming pattern | |
run: | | |
if ! [[ $GITHUB_REF =~ @aliceo2\/[a-z]+-*[a-z]*@*.* ]]; then | |
echo "TAG: ${GITHUB_REF} does not match expected pattern"; | |
exit 1; | |
else | |
echo "TAG is correct" | |
fi | |
- name: Set variables PROJECT and VERSION for what is being released | |
id: set-project | |
run: | | |
VERSION=$( echo "${GITHUB_REF/refs\/tags\/@aliceo2\/}" | cut -f2 -d"@") | |
PROJECT="Bookkeeping" | |
echo "Identified project: $PROJECT with version: $VERSION" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "PROJECT=$PROJECT" >> $GITHUB_ENV | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }} | |
upload-asset: | |
runs-on: ubuntu-latest | |
needs: deploy-npm-module | |
outputs: | |
ASSET_URL: ${{ steps.upload.outputs.asset_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install production dependencies | |
run: npm install --only=production | |
- name: Create package tarball | |
run: echo "tgz_name=$(npm pack)" >> $GITHUB_OUTPUT | |
id: tgz | |
- name: Upload tarball to release assets via GH CLI | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload @aliceo2/bookkeeping@${{ needs.deploy-npm-module.outputs.VERSION }} ${{ steps.tgz.outputs.tgz_name }} | |
- name: Upload TARball to S3 | |
uses: awegrzyn/s3-put-action@v1 | |
with: | |
file: ./${{ steps.tgz.outputs.tgz_name }} | |
bucket: 's3://system-configuration/TARS/' | |
env: | |
ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} |