Bump actions/download-artifact from 4.1.8 to 4.1.9 (#917) #149
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: JavaScript 🟨🟦🟩🟥 Test 🦂 Build 🧱 Release 🚰 and Publish 📦 | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'javascript/**' | |
- '!javascript/**.md' | |
- '!javascript/.vscode/**' | |
- '.github/workflows/javascript-*' | |
workflow_dispatch: | |
permissions: {} | |
defaults: | |
run: | |
shell: bash | |
working-directory: javascript | |
jobs: | |
context: | |
name: GitHub 🐱👤 Context 📑 | |
uses: ./.github/workflows/github-context.yaml | |
test: | |
name: JavaScript 🟨🟦🟩🟥 Test 🦂 | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
uses: ./.github/workflows/javascript-test.yaml | |
workflow-conditions: | |
name: 🛑🛑🛑 Stop builds that didn't change the release version 🛑🛑🛑 | |
runs-on: ubuntu-latest | |
outputs: | |
version-file-changed: ${{ steps.version-file-check.outputs.version-file-changed }} | |
version-tag-exists: ${{ steps.version-tag-exists.outputs.version-tag-exists }} | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 2 | |
- name: Check if version files changed | |
id: version-file-check | |
run: | | |
export VERSION_FILE="javascript/package.json" | |
[ "$(git diff HEAD^1.. --name-only | grep -e "^$VERSION_FILE$")" == "$VERSION_FILE" ] && echo "version-file-changed=${{toJSON(true)}}" >> $GITHUB_OUTPUT || echo "version-file-changed=${{toJSON(false)}}" >> $GITHUB_OUTPUT | |
- name: Notify on version-file-check | |
run: echo "::Notice::version-file-changed is ${{ fromJSON(steps.version-file-check.outputs.version-file-changed) }}" | |
- name: Check if version specified in version file has not released. | |
id: version-tag-exists | |
run: | | |
git fetch --tags | |
export VER=$(grep package.json -e "\"version\":" | cut -d \" -f 4) | |
[ -z "$(git tag -l "javascript-v$VER")" ] && echo "version-tag-exists=${{toJSON(false)}}" >> $GITHUB_OUTPUT || echo "version-tag-exists=${{toJSON(true)}}" >> $GITHUB_OUTPUT | |
- name: Notify on version-tag-exists | |
run: echo "::Notice::version-tag-exists is ${{ fromJSON(steps.version-tag-exists.outputs.version-tag-exists) }}" | |
# Now any step that should only run on the version change can use | |
# "needs: [workflow-conditions]" Which will yield the condition checks below. | |
# We want to "release" automatically if "version-file-changed" is true on push | |
# Or manually if workflow_dispatch. BOTH need "version-tag-exists" is false. | |
build: | |
name: JavaScript 🟨🟦🟩🟥 Build 🧱 | |
needs: [test, workflow-conditions] | |
if: >- | |
${{ ((fromJSON(needs.workflow-conditions.outputs.version-file-changed) == true && github.event_name == 'push') || | |
github.event_name == 'workflow_dispatch') && fromJSON(needs.workflow-conditions.outputs.version-tag-exists) == false }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🟨🟦🟩🟥 Set up Node | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: 'javascript/.nvmrc' | |
cache: 'npm' | |
cache-dependency-path: javascript/package-lock.json | |
- name: 🧱 Install build dependencies | |
run: make setup | |
- name: 🧱 Build | |
run: make build | |
- name: 🆙 Upload dists | |
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
with: | |
name: Package | |
path: javascript/skenvy-collatz-*.tgz | |
if-no-files-found: error | |
release: | |
name: JavaScript 🟨🟦🟩🟥 Release 🚰 | |
needs: [build] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🆒 Download dists | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: Package | |
path: javascript | |
- name: 🚰 Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
export VER=$(grep package.json -e "\"version\":" | cut -d \" -f 4) | |
gh release create javascript-v$VER "$(find . | grep -e skenvy-collatz-*\.tgz)#Package" --generate-notes -t "JavaScript: Version $VER" | |
publish-github: | |
name: JavaScript 🟨🟦🟩🟥 Publish 📦 GitHub 🐱👤 | |
needs: [release] | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🆒 Download dists | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: Package | |
path: javascript/ | |
- name: 🟨🟦🟩🟥 Set up Node | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: 'javascript/.nvmrc' | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@skenvy' | |
cache: 'npm' | |
cache-dependency-path: javascript/package-lock.json | |
- name: 🧱 Install nvm+npm | |
run: make install_npm | |
- name: 📦 Publish | |
run: make publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-npm: | |
name: JavaScript 🟨🟦🟩🟥 Publish 📦 NPM 🟥 | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🆒 Download dists | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: Package | |
path: javascript/ | |
- name: 🟨🟦🟩🟥 Set up Node | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: 'javascript/.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@skenvy' | |
cache: 'npm' | |
cache-dependency-path: javascript/package-lock.json | |
- name: 🧱 Install nvm+npm | |
run: make install_npm | |
- name: 📦 Publish | |
run: make publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-jsr: | |
name: JavaScript 🟨🟦🟩🟥 Publish 📦 JSR 🟥 | |
needs: [release] | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🧱 Install dependencies | |
run: make setup | |
- name: 📦 Publish | |
run: npm run publish:jsr | |
docs: | |
name: JavaScript 🟨🟦🟩🟥 Docs 📄 | |
needs: [release, publish-github, publish-npm, publish-jsr] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏁 Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🟨🟦🟩🟥 Set up Node | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: 'javascript/.nvmrc' | |
cache: 'npm' | |
cache-dependency-path: javascript/package-lock.json | |
- name: 🧱 Install build dependencies | |
run: make setup | |
- name: 📄 Docs Generation | |
run: make docs | |
- name: 📄 Docs Publishing | |
run: | | |
git config --local user.email "actions@github.com" | |
git config --local user.name "Github Actions" | |
export SHORTSHA=$(git rev-parse --short HEAD) | |
git fetch origin gh-pages-javascript:gh-pages-javascript | |
git symbolic-ref HEAD refs/heads/gh-pages-javascript | |
cd .. && mv javascript/docs ../MERGE_TARGET | |
git rm -rf . && git clean -fxd && git reset | |
shopt -s dotglob && mkdir -p javascript/coverage | |
mv ../MERGE_TARGET/tsdoc/* javascript/ | |
mv ../MERGE_TARGET/coverage/* javascript/coverage | |
git add . | |
git commit -m "Build based on $SHORTSHA" --allow-empty | |
git push --set-upstream origin gh-pages-javascript | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docs-merge: | |
name: GitHub 🐱👤 Pages 📄 Merger 🧬 | |
needs: [docs] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
uses: ./.github/workflows/github-pages.yaml | |
with: | |
merge_from: 'gh-pages-javascript' |