mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-15 17:26:44 +00:00
* Update to the latest available actions * Remove dependency on deprecated release actions * Add release workflow fixes from testing
70 lines
2.7 KiB
YAML
70 lines
2.7 KiB
YAML
name: CD - Release new version
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Bootstrap the packages
|
|
run: npm run bootstrap
|
|
|
|
- name: Build packages
|
|
run: npm run build-all
|
|
|
|
- uses: actions/github-script@v7
|
|
id: releaseVersion
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
const fs = require('fs');
|
|
return require('./package.json').version
|
|
|
|
- name: Zip up releases
|
|
run: |
|
|
zip -r -j actions-runner-hooks-docker-${{ steps.releaseVersion.outputs.result }}.zip packages/docker/dist
|
|
zip -r -j actions-runner-hooks-k8s-${{ steps.releaseVersion.outputs.result }}.zip packages/k8s/dist
|
|
|
|
- name: Calculate SHA
|
|
id: sha
|
|
shell: bash
|
|
run: |
|
|
sha_docker=$(sha256sum actions-runner-hooks-docker-${{ steps.releaseVersion.outputs.result }}.zip | awk '{print $1}')
|
|
echo "Docker SHA: $sha_docker"
|
|
echo "docker-sha=$sha_docker" >> $GITHUB_OUTPUT
|
|
sha_k8s=$(sha256sum actions-runner-hooks-k8s-${{ steps.releaseVersion.outputs.result }}.zip | awk '{print $1}')
|
|
echo "K8s SHA: $sha_k8s"
|
|
echo "k8s-sha=$sha_k8s" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create release notes
|
|
id: releaseNotes
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
var releaseNotes = fs.readFileSync('${{ github.workspace }}/releaseNotes.md', 'utf8').replace(/<HOOK_VERSION>/g, '${{ steps.releaseVersion.outputs.result }}')
|
|
releaseNotes = releaseNotes.replace(/<DOCKER_SHA>/g, '${{ steps.sha.outputs.docker-sha }}')
|
|
releaseNotes = releaseNotes.replace(/<K8S_SHA>/g, '${{ steps.sha.outputs.k8s-sha }}')
|
|
console.log(releaseNotes)
|
|
fs.writeFileSync('${{ github.workspace }}/finalReleaseNotes.md', releaseNotes);
|
|
|
|
- name: Create ${{ steps.releaseVersion.outputs.result }} Hook Release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release create v${{ steps.releaseVersion.outputs.result }} \
|
|
--title "v${{ steps.releaseVersion.outputs.result }}" \
|
|
--repo ${{ github.repository }} \
|
|
--notes-file ${{ github.workspace }}/finalReleaseNotes.md \
|
|
--latest \
|
|
${{ github.workspace }}/actions-runner-hooks-k8s-${{ steps.releaseVersion.outputs.result }}.zip \
|
|
${{ github.workspace }}/actions-runner-hooks-docker-${{ steps.releaseVersion.outputs.result }}.zip |