Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release automation of published artifacts #20

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
- main

jobs:
test:
name: Run all Verifications/Tests
unit_tests:
name: Verify Tests
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Read Node version
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -26,21 +26,21 @@ jobs:
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --all --parallel
run: yarn nx run-many --target=test/unit --all --parallel --verbose

deploy:
name: Deploy Affected Apps
runs-on: self-hosted
needs:
- test
- unit_tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release a new version of Playnite-Web

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write
pull-requests: write

jobs:
on_tag_created:
name: On Release Published
needs: []

runs-on: self-hosted

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "7.0.403"
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}

- name: Package apps
run: yarn nx affected --target=package --parallel --base=HEAD~ --head=HEAD --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
LICENSE
apps/*/.packaged/*.zip
12 changes: 4 additions & 8 deletions .github/workflows/pull-request-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ on:
- main

jobs:
run_tests:
unit_tests:
name: Verify PR - Tests
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Save version
run: echo "latest" > version
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -40,14 +38,12 @@ jobs:
name: Verify PR - Buildable
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Save version
run: echo "latest" > version
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -64,7 +60,7 @@ jobs:
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Compile affected apps
run: yarn nx affected --target=compile --parallel --base=HEAD~ --head=HEAD --verbose
run: yarn nx affected --target=build --parallel --base=HEAD~ --head=HEAD --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

.dist
.test-runs
.packaged
2 changes: 1 addition & 1 deletion apps/playnite-web-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playnite-web-plugin",
"version": "1.0.0",
"version": "0.0.1",
"devDependencies": {
"nx": "^17.1.2",
"rimraf": "^5.0.5"
Expand Down
9 changes: 8 additions & 1 deletion apps/playnite-web-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"executor": "nx:run-commands",
"outputs": ["{projectRoot}/.dist"],
"options": {
"command": "yarn rimraf .dist",
"command": "yarn rimraf .dist .packaged .test-runs",
"cwd": "{projectRoot}"
}
},
Expand All @@ -18,6 +18,13 @@
"cwd": "{projectRoot}/src"
}
},
"package": {
"executor": "nx:run-commands",
"options": {
"command": "zip -r .packaged/playnite-web-plugin.zip .dist/bin/Release/",
"cwd": "{projectRoot}"
}
},
"test/unit": {
"executor": "nx:run-commands",
"options": {
Expand Down
4 changes: 4 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"dependsOn": ["^build", "restore"],
"cache": true
},
"package": {
"dependsOn": ["build"],
"cache": false
},
"test/unit": {
"dependsOn": ["restore", "^restore"],
"cache": true
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "playnite-web",
"packageManager": "[email protected]",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=20.9.0",
Expand Down
Loading