Skip to content

Commit

Permalink
chore: set up continous delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoVazquez committed Aug 6, 2023
1 parent 9076466 commit 052f7bf
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 6 deletions.
21 changes: 20 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@ name: Setup

description: Setup Node.js, cache and install dependencies

inputs:
git_bot_token:
description: Git Bot token used to push to protected branches because github token can't
required: false


runs:
using: composite
steps:
# Needed for nx affected command, it set the BASE and HEAD env variables

- name: Checkout all commits
uses: actions/checkout@v3
with:
token: ${{ inputs.git_bot_token || github.token }}
fetch-depth: 0

# Needed for nx affected command, it set the BASE and HEAD env variables
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3


- name: Setup git user to "🤖 naxode bot"
shell: bash
run: git config user.email "-" && git config user.name "🤖 naxodev bot"


- name: Determine Node.js version
id: node_version
shell: bash
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
- workflow_dispatch

jobs:
release:
runs-on: ubuntu-latest

if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
git_bot_token: ${{ secrets.GIT_BOT_TOKEN }}

- name: Release
env:
NODE_AUTH_TOKEN: ${{ inputs.NPM_TOKEN }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
# Use npx instead of yarn because yarn automagically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
shell: bash
run: npx nx affected --base=last-release --target=version

- name: Tag last-release
shell: bash
run: git tag -f last-release

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ inputs.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true
tags: true
32 changes: 27 additions & 5 deletions packages/plugins/nx-cloudflare/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
]
}
},
"publish": {
"command": "node tools/scripts/publish.mjs plugins-nx-cloudflare {args.ver} {args.tag}",
"dependsOn": ["build"]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
Expand Down Expand Up @@ -67,9 +63,35 @@
}
},
"version": {
"dependsOn": ["build"],
"executor": "@jscutlery/semver:version",
"options": {
"preset": "conventional"
"preset": "conventional",
"tagPrefix": "v",
"noVerify": true,
"push": true,
"preid": "beta",
"syncVersions": false,
"commitMessageFormat": "release(${projectName}): 🎸 cut release to ${version}",
"postTargets": [
"plugins-nx-cloudflare:github",
"plugins-nx-cloudflare:publish"
]
}
},
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "${tag}",
"notes": "${notes}"
}
},
"publish": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public",
"tag": "next",
"distFolderPath": "dist/packages/ngworker/lumberjack"
}
}
},
Expand Down

0 comments on commit 052f7bf

Please sign in to comment.