diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml new file mode 100644 index 0000000000000000000000000000000000000000..758530d2b88a376683bbf5ff305fc877dcaf6104 --- /dev/null +++ b/.github/workflows/release-docker.yml @@ -0,0 +1,16 @@ +name: release-docker +on: + repository_dispatch: + types: [renovate-release] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.client_payload.ref }} + + - run: echo 'docker release' + - run: echo ${{ github.event.client_payload.sha }} + - run: echo ${{ github.event.client_payload.version }} diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml new file mode 100644 index 0000000000000000000000000000000000000000..6aff7fc71a3348200b60bc06bc504705b8545009 --- /dev/null +++ b/.github/workflows/release-npm.yml @@ -0,0 +1,16 @@ +name: release-npm +on: + repository_dispatch: + types: [renovate-release] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.client_payload.ref }} + + - run: echo 'npm release' + - run: echo ${{ github.event.client_payload.sha }} + - run: echo ${{ github.event.client_payload.version }} diff --git a/.releaserc b/.releaserc index 4ab3967fa3f313c0cc80b2f44abfc72013a51024..2f608f64c0cea093cd8e79bf990e0f34d1070f74 100644 --- a/.releaserc +++ b/.releaserc @@ -5,7 +5,7 @@ [ "@semantic-release/exec", { - "publishCmd": "./.github/workflows/release-docker.sh ${nextRelease.version} ${nextRelease.gitHead}" + "publishCmd": "./.github/workflows/release-docker.sh ${nextRelease.version} ${nextRelease.gitHead} && yarn dispatch-release ${nextRelease.version}" } ], "@semantic-release/github", diff --git a/package.json b/package.json index 9013691f1656e32dc6f114cb3ef68df64db19bd8..933fc4899b63f85027ac34eb0c3b526ef10a0d3d 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "copy-static-files": "copyfiles -u 1 -e **/__fixtures__/** -e **/__mocks__/** lib/**/*.json lib/**/*.py dist/", "create-json-schema": "babel-node --extensions \".ts,.js\" -- bin/create-json-schema.js && prettier --write \"renovate-schema.json\"", "debug": "babel-node --inspect-brk --extensions \".ts,.js\" -- lib/renovate.ts", + "dispatch-release": "node --experimental-modules tools/dispatch-release.mjs", "eslint": "eslint --ext .js,.mjs,.ts lib/ test/ tools/", "eslint-fix": "eslint --ext .js,.mjs,.ts --fix lib/ test/ tools/", "jest": "cross-env NODE_ENV=test LOG_LEVEL=fatal node --expose-gc node_modules/jest/bin/jest.js", diff --git a/tools/dispatch-release.mjs b/tools/dispatch-release.mjs new file mode 100644 index 0000000000000000000000000000000000000000..acd61dd550a9266b11297fc0163dd34109b9c855 --- /dev/null +++ b/tools/dispatch-release.mjs @@ -0,0 +1,27 @@ +import got from 'got'; +import shell from 'shelljs'; + +const baseUrl = 'https://api.github.com/'; + +(async () => { + await got(`repos/${process.env.GITHUB_REPOSITORY}/dispatches`, { + baseUrl, + headers: { + 'user-agent': 'Renovate release helper', + authorization: `token ${process.env.GITHUB_TOKEN}`, + }, + json: true, + retry: 5, + body: { + event_type: 'renovate-release', + // max 10 keys here, https://github.com/peter-evans/repository-dispatch#client-payload + client_payload: { + sha: process.env.GITHUB_SHA, + ref: process.env.GITHUB_REF, + }, + }, + }); +})().catch(e => { + // Ignore for now + shell.echo(e.toString()); +}); diff --git a/tools/package.json b/tools/package.json index ea8274c89f651799d6c49dbae07c5cc5eec85fbb..bc96b581dedd8357fa7d5c68678c628f66ca27fa 100644 --- a/tools/package.json +++ b/tools/package.json @@ -2,6 +2,7 @@ "private":true, "type": "module", "dependencies": { - "shelljs": "0.8.3" + "shelljs": "0.8.3", + "got": "9.6.0" } }