Merge pull request #3 from underrobyn/dependabot/npm_and_yarn/src/oct… #30
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: Build | |
env: | |
TFX_VERSION: "0.16.0" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
paths: | |
- "src/**" | |
- ".github/workflows/build-tfx.yml" | |
- "!LICENSE" | |
- "!README.md" | |
- "!docs/**" | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: Version Artifact | |
run: | | |
# Update task patch number to match build number | |
echo "`jq '.version.Patch=${{ github.run_number }}' src/task/task.json`" > src/task/task.json | |
# Current version from vss-extension manifest | |
current_version=$(jq -r '.version' src/vss-extension.json) | |
# Increment with build number as patch | |
IFS='.' read -ra version_parts <<< "$current_version" | |
version_parts[2]="${GITHUB_RUN_NUMBER:-0}" | |
updated_version=$(IFS='.'; echo "${version_parts[*]}") | |
# Update versions in overrides files | |
jq ".version |= \"0.$updated_version\"" src/overrides.dev.json > src/overrides.dev.json.tmp && mv src/overrides.dev.json.tmp src/overrides.dev.json | |
jq ".version |= \"$updated_version\"" src/overrides.prod.json > src/overrides.prod.json.tmp && mv src/overrides.prod.json.tmp src/overrides.prod.json | |
echo -e "New versions are ->\n\tDev: 0.$updated_version\n\tProd: $updated_version" | |
- name: Install | |
run: npm install | |
working-directory: '${{ github.workspace }}/src' | |
- name: Build | |
run: npm run build | |
working-directory: '${{ github.workspace }}/src' | |
- name: Install tfx-cli | |
run: npm i -g tfx-cli@$TFX_VERSION | |
- name: Update task files | |
run: | | |
cp $GITHUB_WORKSPACE/README.md $GITHUB_WORKSPACE/src/README.md | |
cp $GITHUB_WORKSPACE/LICENSE $GITHUB_WORKSPACE/src/LICENSE.md | |
- name: Package (Dev) | |
run: > | |
tfx extension create | |
--root src | |
--manifest-globs vss-extension.json | |
--output-path $GITHUB_WORKSPACE/builds/dev | |
--overrides-file $GITHUB_WORKSPACE/src/overrides.dev.json | |
- name: Package (Prod) | |
run: > | |
tfx extension create | |
--root src | |
--manifest-globs vss-extension.json | |
--output-path $GITHUB_WORKSPACE/builds/prod | |
--overrides-file $GITHUB_WORKSPACE/src/overrides.prod.json | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/builds/* | |
name: dependabot-fail-task | |
Publish: | |
runs-on: ubuntu-latest | |
needs: [ Build ] | |
steps: | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dependabot-fail-task | |
- name: Install tfx-cli | |
run: npm i -g tfx-cli@$TFX_VERSION | |
# Docs: https://learn.microsoft.com/en-us/azure/devops/extend/publish/command-line?view=azure-devops | |
- name: Publish (Dev) | |
if: github.ref == 'refs/heads/main' | |
run: > | |
tfx extension publish | |
--vsix $GITHUB_WORKSPACE/dev/*.vsix | |
--auth-type pat | |
--token ${{ secrets.AZURE_DEVOPS_PAT }} | |
--share-with robyn-zip-testing | |
- name: Publish (Prod) | |
if: startsWith(github.ref, 'refs/tags/') | |
run: > | |
tfx extension publish | |
--vsix $GITHUB_WORKSPACE/prod/*.vsix | |
--auth-type pat | |
--token ${{ secrets.AZURE_DEVOPS_PAT }} |