@aliceo2/[email protected] #308
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] | |
jobs: | |
deploy-npm-module: | |
runs-on: ubuntu-latest | |
outputs: | |
PROJECT: ${{ steps.set-project.outputs.project }} | |
VERSION: ${{ steps.set-project.outputs.version }} | |
TAG: ${{ steps.set-project.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.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: ${GITHUB_REF}" | |
fi | |
- name: Set variable TAG as name of project that is being released | |
id: set-project | |
run: | | |
TAG=$( echo "${GITHUB_REF/refs\/tags\/@aliceo2\/}" | cut -f1 -d"@") | |
VERSION=$( echo "${GITHUB_REF/refs\/tags\/@aliceo2\/}" | cut -f2 -d"@") | |
if [ "$TAG" = "qc" ]; then PROJECT="QualityControl" | |
elif [ "$TAG" = "control" ]; then PROJECT="Control" | |
elif [ "$TAG" = "infologger" ]; then PROJECT="InfoLogger" | |
elif [ "$TAG" = "web-ui" ]; then PROJECT="Framework" | |
else echo "Project identified is UNKNOWN"; exit 1; | |
fi | |
echo "Identified project is $PROJECT with version $VERSION" | |
echo "PROJECT=$PROJECT" >> $GITHUB_ENV | |
echo "project=$PROJECT" >> $GITHUB_OUTPUT | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- run: (cd $PROJECT; npm publish) | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }} | |
upload-asset: | |
runs-on: ubuntu-latest | |
needs: deploy-npm-module | |
if: ${{ needs.deploy-npm-module.outputs.PROJECT != 'Framework' }} | |
outputs: | |
ASSET_URL: ${{ steps.upload.outputs.asset_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install production deps | |
run: npm install --only=production | |
working-directory: ${{ needs.deploy-npm-module.outputs.PROJECT }} | |
- name: Create package tarball | |
run: echo "tgz_name=$(npm pack)" >> $GITHUB_OUTPUT | |
working-directory: ${{ needs.deploy-npm-module.outputs.PROJECT }} | |
id: tgz | |
- name: Upload tarball to release assets via GH HTTP API | |
working-directory: ${{ needs.deploy-npm-module.outputs.PROJECT }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload @aliceo2/${{ needs.deploy-npm-module.outputs.TAG }}@${{ needs.deploy-npm-module.outputs.VERSION }} ${{ steps.tgz.outputs.tgz_name }} | |
- name: Upload TARball to S3 | |
uses: awegrzyn/s3-put-action@v1 | |
with: | |
file: ./${{ needs.deploy-npm-module.outputs.PROJECT }}/${{ steps.tgz.outputs.tgz_name }} | |
bucket: 's3://system-configuration/TARS/' | |
env: | |
ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} |