ci: integrate git next tag #130
Workflow file for this run
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: ci | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
packages: ${{ steps.packages.outputs.packages }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: packages | |
shell: bash | |
run: | | |
PACKAGES_LIST=$(find . -mindepth 2 -maxdepth 2 -type f -name deno.jsonc -exec bash -c 'basename $(dirname {})' \;) | |
PACKAGES_LIST_JSON=$(echo "$PACKAGES_LIST" | jq --raw-input --compact-output --slurp 'split("\n")[:-1]') | |
echo "packages: $PACKAGES_LIST_JSON" | |
echo "packages=$PACKAGES_LIST_JSON" >> $GITHUB_OUTPUT | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{fromJson(needs.setup.outputs.packages)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: 1.x | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 1.x | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- run: deno task ${{ matrix.package }}:ci | |
tag: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
- test | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{fromJson(needs.setup.outputs.packages)}} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: tagging | |
uses: ldelarue/[email protected] | |
with: | |
tag-prefix: ${{ matrix.package }}- | |
scope: ${{ matrix.package }} | |
- uses: denoland/setup-deno@v1 | |
- if: ${{ steps.tagging.outputs.tag }} | |
shell: bash | |
run: | | |
deno task tag --version '${{ steps.tagging.outputs.semver }}' ${{ matrix.package }} | |
deno fmt ${{ matrix.package }}/deno.jsonc | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git tag '${{ steps.tagging.outputs.tag }}' | |
git show-ref --tags '${{ steps.tagging.outputs.tag }}' | |
git push origin '${{ steps.tagging.outputs.tag }}' | |
publish: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
- test | |
- tag | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{fromJson(needs.setup.outputs.packages)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
- run: deno task ${{ matrix.package }}:publish | |