Build #1034
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 | |
on: | |
workflow_call: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
# Daily 5am australian/brisbane time (7pm UTC) | |
- cron: "0 19 * * *" | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
release-tag: | |
description: "The tag of the release being replicated in Octopus Deploy" | |
required: true | |
env: | |
PACKAGE_VERSION: 6.0.${{ github.run_number }} | |
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }} | |
OCTOPUS_API_KEY: ${{ secrets.INTEGRATIONS_API_KEY }} | |
jobs: | |
build: | |
name: Build code | |
runs-on: ubuntu-latest | |
outputs: | |
package_version: ${{ steps.build.outputs.package_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
cache: "npm" | |
- name: Build | |
id: build | |
run: | | |
npm ci | |
npm run build -- --extensionVersion $PACKAGE_VERSION | |
echo "::set-output name=package_version::$PACKAGE_VERSION" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
test: | |
name: Run test matrix | |
needs: build | |
runs-on: ${{ matrix.os }} | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
strategy: | |
matrix: | |
os: [windows-2022, ubuntu-20.04, macos-12] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
cache: "npm" | |
- name: Test | |
run: | | |
npm ci | |
npm run test | |
- uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
name: Tests report | |
with: | |
name: Tests report | |
path: "reports/jest-*.xml" | |
reporter: jest-junit | |
package: | |
name: Package and Push artifacts to Octopus | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' || (github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
cache: "npm" | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "^1.19.5" | |
- name: Embed octo portable | |
run: | | |
pwsh ./embed-octo.ps1 | |
- name: Replace versions in tasks and create vsix | |
run: | | |
./pack.ps1 -environment Production -version ${{ needs.build.outputs.package_version }} -setupTaskDependencies | |
./pack.ps1 -environment Test -version ${{ needs.build.outputs.package_version }} | |
shell: pwsh | |
- name: Create Packages | |
id: create-packages | |
run: | | |
tar -czf OctoTFS.vsix.${{ needs.build.outputs.package_version }}.tar.gz ./Artifacts/**/*.vsix | |
tar -czf OctoTFS.publish.${{ needs.build.outputs.package_version }}.tar.gz ./publish.ps1 ./dist/extension-manifest*.json | |
- name: Push Package 🐙 | |
uses: OctopusDeploy/push-package-action@v3 | |
with: | |
space: "Integrations" | |
packages: | | |
OctoTFS.vsix.${{ needs.build.outputs.package_version }}.tar.gz | |
OctoTFS.publish.${{ needs.build.outputs.package_version }}.tar.gz | |
- name: Fetch Release Notes | |
id: fetch-release-notes | |
if: github.event_name == 'release' | |
run: | | |
echo "::debug::${{github.event_name}}" | |
OUTPUT_FILE="release_notes.txt" | |
jq --raw-output '.release.body' ${{ github.event_path }} | sed 's#\r# #g' > $OUTPUT_FILE | |
echo "::set-output name=release-note-file::$OUTPUT_FILE" | |
- name: Create a release in Octopus Deploy 🐙 | |
uses: OctopusDeploy/create-release-action@v3 | |
with: | |
space: "Integrations" | |
project: "Azure DevOps Extension" | |
package_version: ${{ needs.build.outputs.package_version }} | |
channel: ${{ (github.event_name == 'release' && 'Release') || '' }} | |
release_notes_file: ${{ (github.event_name == 'release' && steps.fetch-release-notes.outputs.release-note-file) || ''}} | |
git_ref: ${{ (github.ref_type == 'tag' && 'main' ) || (github.head_ref || github.ref) }} | |
git_commit: ${{ github.event.after || github.event.pull_request.head.sha }} |