Skip to content

Commit

Permalink
build: first test to for reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianSchuetze committed Oct 1, 2023
1 parent 595707f commit 4326c75
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 30 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ jobs:
- name: Lint
run: npm run lint

- name: Build (prod)
- name: Build
run: npm run build:prod

- name: Package (prod)
- name: Package
run: npm run package:prod

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: banner-settings-extension
path: ${{ github.workspace }}/*.vsix
path: |
${{ github.workspace }}/ado-manifests/*
${{ github.workspace }}/*.vsix
47 changes: 47 additions & 0 deletions .github/workflows/release.job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Stage Release
on:
workflow_call:
inputs:
env_suffix:
required: true
type: string
should_share:
required: true
type: boolean
secrets:
azure_devops_token:
required: true

jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.env_suffix }}
steps:
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
name: banner-settings-extension
path: ./artifacts
search_artifacts: true

- name: Install TFX CLI
run: npm install -g tfx-cli

- name: Find VSIX filename
id: findfile
run: echo "VSIX_FILE_NAME=$(ls ./artifacts/*.vsix)" >> $GITHUB_ENV

- name: Publish
run: |
SHARE_OPTION=""
if [[ "${{ inputs.should_share }}" == "true" ]]; then
SHARE_OPTION="--share-with razorspoint-test"
fi
tfx extension publish \
--vsix ./artifacts/${{ env.VSIX_FILE_NAME }} \
--publisher razorspoint \
--manifests ./artifacts/ado-manifests/azure-devops-extension-base.json \
--overrides-file ./artifacts/ado-manifests/azure-devops-extension-${{ inputs.env_suffix }}.json \
$SHARE_OPTION \
--token ${{ secrets.azure_devops_token }}
36 changes: 15 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,19 @@ on:
- completed

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }}
environment: development
deploy_test:
uses: ./.github/workflows/release.job.yml
with:
env_suffix: 'test'
should_share: true
secrets:
azure_devops_token: ${{ secrets.AZURE_DEVOPS_TOKEN }}

steps:
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
name: banner-settings-extension
path: ./artifacts
search_artifacts: true

- name: Install TFX CLI
run: npm install -g tfx-cli

- name: Authenticate and Publish
env:
AZURE_DEVOPS_EXT_PAT: ${{ secrets.AZURE_DEVOPS_TOKEN }}
run: |
tfx extension publish --manifest-globs vss-extension.json --service-url https://dev.azure.com/myorg --token $AZURE_DEVOPS_EXT_PAT
deploy_prod:
needs: deploy_test
uses: ./.github/workflows/release.job.yml
with:
env_suffix: 'prod'
should_share: false
secrets:
azure_devops_token: ${{ secrets.AZURE_DEVOPS_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "banner-settings-hub-improved-ppe",
"name": "Banner Settings (PPE)",
"id": "banner-settings-hub-improved-test",
"name": "Banner Settings (Test)",
"version": "1.0.71",
"publisher": "razorspoint",
"public": false,
Expand All @@ -18,7 +18,7 @@
"ms.vss-features.host-dialog-service"
],
"properties": {
"name": "Banner (PPE)",
"name": "Banner (Test)",
"uri": "dist/index.html",
"icon": "asset://static/sample-icon.png"
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"build:dev": "npm run compile:dev",
"package:dev": "npm run package:vsts-extension --vssconfig=dev",
"publish:dev": "npm run publish:vsts-extension --vssconfig=dev",
"build:ppe": "npm run compile",
"package:ppe": "npm run package:vsts-extension --vssconfig=ppe",
"publish:ppe": "npm run publish:vsts-extension --vssconfig=ppe",
"build:test": "npm run compile",
"package:test": "npm run package:vsts-extension --vssconfig=test",
"publish:test": "npm run publish:vsts-extension --vssconfig=test",
"build:prod": "npm run compile",
"package:prod": "npm run package:vsts-extension --vssconfig=prod",
"publish:prod": "npm run publish:vsts-extension --vssconfig=prod",
Expand Down

0 comments on commit 4326c75

Please sign in to comment.