readme: add link to Squeak e.V. slides #251
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, workflow_dispatch] | |
jobs: | |
create-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: LinqLover/create-image@master | |
id: create-image | |
with: | |
squeak-version: trunk | |
prepare-script: ./scripts/prepareImage.st | |
- uses: actions/upload-artifact@master | |
with: | |
name: image | |
path: ${{ steps.create-image.outputs.bundle-path }} | |
build-screenshots: | |
needs: create-image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@master | |
with: | |
name: image | |
- name: Build screenshots and help | |
run: | | |
unzip Squeak*.zip | |
./squeak.sh -headless $(realpath ./scripts/buildScreenshots.st) | |
cp -r Squeak*.app/Contents/Resources/screenshots/ . | |
cp -r Squeak*.app/Contents/Resources/help/ . | |
- uses: actions/upload-artifact@master | |
with: | |
name: screenshots | |
path: screenshots/ | |
- uses: actions/upload-artifact@master | |
with: | |
name: help | |
path: help/ | |
update-screenshots: | |
needs: | |
- build-screenshots | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- run: rm -rf screenshots/ help/ | |
- uses: actions/download-artifact@master | |
with: | |
name: screenshots | |
path: screenshots/ | |
- uses: actions/download-artifact@master | |
with: | |
name: help | |
path: help/ | |
- uses: EndBug/add-and-commit@v9 | |
id: commit | |
with: | |
default_author: github_actions | |
add: screenshots/ help/ | |
message: "Update screenshots/help for ${{ github.sha }}" | |
push: ${{ github.ref == 'refs/heads/main' }} | |
- uses: actions/setup-node@v3 | |
if: ${{ steps.commit.outputs.committed == 'true' }} # only required for commit comment below | |
with: | |
node-version: 16 | |
- run: | | |
npm install -g [email protected] # https://github.com/nodegit/nodegit/issues/1840 | |
npm link nodegit | |
if: ${{ steps.commit.outputs.committed == 'true' }} # only required for commit comment below | |
- if: ${{ steps.commit.outputs.committed == 'true' }} # no changes -> no commit -> no comment | |
name: Create commit comment for screenshot/help diff | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const nodegit = require('nodegit') | |
const crypto = require('crypto') | |
const diffId = (diffFile) => crypto.createHash('sha256').update(diffFile.path()).digest('hex') | |
const repo = await nodegit.Repository.open('.') | |
const commit = await repo.getCommit('${{ steps.commit.outputs.commit_long_sha }}') | |
const patches = (await Promise.all((await commit.getDiff()).map(diff => diff.patches()))).flatMap(patch => patch) | |
const files = patches.map(patch => patch.newFile() ?? patch.oldFile()) | |
const builderUrl = `${{ github.server_url }}/${{ github.repository }}/tree/HEAD/packages/TraceDebuggerJobs.package` | |
const genericArtifactUrl = `${{ github.server_url }}/${{ github.repository }}/tree/gh-pages` | |
await github.rest.repos.createCommitComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
commit_sha: context.sha, | |
body: `## Changed Screenshots/Help | |
This push caused [a change of ${files.length} ${files.length === 1 ? 'artifact' : 'artifacts'}](${${{ steps.commit.outputs.pushed }} ? `${{ github.server_url }}/${{ github.repository }}/commit/${commit.sha()}` : builderUrl})${{ steps.commit.outputs.pushed && ' against the default branch' || '' }}: | |
${files | |
.map(file => | |
`- [${file.path()}](${ | |
${{ steps.commit.outputs.pushed }} | |
? `${{ github.server_url }}/${{ github.repository }}/commit/${commit.sha()}#diff-${diffId(file)}` | |
: `${genericArtifactUrl}/${file.path()}` | |
})`) | |
.join('\n')} | |
`, | |
}) | |
release-image: | |
needs: create-image | |
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- id: date | |
run: echo "date=$(date +'%Y%m%d-%H%M%S')" >> "$GITHUB_OUTPUT" | |
- uses: actions/download-artifact@master | |
with: | |
name: image | |
- run: mv Squeak*.zip TraceDebugger-${{ steps.date.outputs.date }}.zip | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: untagged-${{ steps.date.outputs.date }} | |
body: ${{ github.event.head_commit.message }} | |
files: TraceDebugger-*.zip | |
fail_on_unmatched_files: true | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- uses: dev-drprasad/[email protected] | |
with: | |
delete_tag_pattern: untagged- | |
keep_latest: 2 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |