Skip to content

Commit

Permalink
fix: Update build pipeline to our new process (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn authored Jun 28, 2022
1 parent 810f0d1 commit 2580363
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 72 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/ci.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
branches:
- release-please--**
name: "Build & Push Dist"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.INTEGRATIONS_FNM_BOT_TOKEN }}
- name: install
run: npm ci
- name: build
run: npm run build
- name: update README
run: |-
MAJOR_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[", ]//g' \
| awk -F. '{ print $1 }')
sed -i "s/\(uses: OctopusDeploy\/install-octopus-cli-action@\).*/\1v${MAJOR_VERSION}/g" README.md
- name: commit
run: |-
git config --global user.name "team-integrations-fnm-bot"
git config user.email 'integrationsfnmbot@octopus.com'
git add README.md
git add dist/
git diff-index --quiet HEAD || (git commit -m "chore: build dist and update README" && git push origin)
19 changes: 0 additions & 19 deletions .github/workflows/publish.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on:
push:
branches:
- main
name: release-please
env:
ACTION_NAME: install-octopus-cli-action
jobs:
release-please-release:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
package-name: ${{env.ACTION_NAME}}
release-type: node
token: ${{ github.token }}
command: github-release
- uses: actions/checkout@v3
- name: tag major and minor versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :v${{ steps.release.outputs.major }} || true
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git push origin v${{ steps.release.outputs.major }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
release-please-pr:
runs-on: ubuntu-latest
needs:
- release-please-release
steps:
- id: release-pr
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.INTEGRATIONS_FNM_BOT_TOKEN }}
release-type: node
package-name: ${{env.ACTION_NAME}}
command: release-pr
38 changes: 27 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
name: 'build-test'
on:
pull_request:
push:

schedule:
# Daily 5am australian/brisbane time (7pm UTC)
- cron: '0 19 * * *'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ubuntu-latest
# https://github.com/dorny/test-reporter/issues/168
permissions:
statuses: write
checks: write

steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- run: npm install
- run: npm run all
- uses: actions/checkout@v3

- name: Install package dependencies
run: npm install

- name: Compile and run tests
run: npm run all

- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: JEST Tests
path: 'reports/jest-*.xml'
reporter: jest-junit

- name: Install Octopus CLI
uses: ./
with:
version: latest
- run: octo version

- run: octo version
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@ lib/**/*
# ignore test artifacts
*.pdb
octo
out
out
reports/
58 changes: 58 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"eslint-plugin-jest": "^26.2.2",
"jest": "^28.1.0",
"jest-circus": "^28.1.0",
"jest-junit": "^14.0.0",
"js-yaml": "^4.1.0",
"prettier": "2.6.2",
"tmp": "^0.2.1",
Expand Down Expand Up @@ -51,6 +52,15 @@
},
"verbose": true
},
"jest-junit": {
"outputDirectory": "reports",
"outputName": "jest-junit.xml",
"ancestorSeperator": " > ",
"uniqueOutputName": "false",
"suiteNameTemplate": "{filepath}",
"classNameTemplate": "{classname}",
"titleTemplate": "{title}"
},
"keywords": [
"cli",
"deployment",
Expand All @@ -70,8 +80,8 @@
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"prebuild": "eslint src/**/*.ts",
"postbuild": "ncc build -o dist",
"test": "jest --passWithNoTests"
"postbuild": "ncc build out/main.js -o dist",
"test": "jest --ci --reporters=default --reporters=jest-junit --passWithNoTests"
},
"version": "1.3.0"
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./dist",
"outDir": "./out",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
Expand Down

0 comments on commit 2580363

Please sign in to comment.