Skip to content

Commit

Permalink
chore(ci): create dev releases for non-draft PRs (ionic-team#1828)
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-MikeS authored and LaravelFreelancerNL committed Dec 19, 2023
1 parent 1e6bfa3 commit 844504a
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/dev-releases-for-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release Dev Build for PR

on:
pull_request:
types:
- opened
- synchronize

jobs:
setup:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
timeout-minutes: 30
outputs:
plugins: ${{ steps.packages.outputs.paths }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@ce177499ccf9fd2aded3b0426c97e5434c2e8a73
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Latest
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- uses: actions/checkout@v3
- name: Restore Dependency Cache
id: cache-modules
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- id: files
uses: tj-actions/changed-files@v37
with:
json: true
write_output_files: true
- id: catjson
run: |
echo "FILES_JSON=$(cat .github/outputs/all_changed_files.json)" >> $GITHUB_OUTPUT
- id: packages
uses: ./.github/actions/changed-packages
with:
files: ${{ steps.catjson.outputs.FILES_JSON }}

release-dev-of-plugins:
runs-on: macos-12
timeout-minutes: 30
permissions:
pull-requests: write
needs:
- setup
strategy:
matrix:
plugin: ${{ fromJson(needs.setup.outputs.plugins) }}
steps:
- uses: actions/setup-node@v3
with:
node-version: 18.18.0
- uses: actions/checkout@v3
- name: Restore Dependency Cache
id: cache-modules
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date +\"%Y%m%dT%H%M%S\")
npm publish --tag dev --dry-run
working-directory: ${{ matrix.plugin }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
with:
path: ${{ matrix.plugin }}
- uses: mshick/add-pr-comment@v2
with:
message: |
Released dev build of ${{ matrix.plugin }} with dev version: ${{ steps.package-version.outputs.current-version }}

0 comments on commit 844504a

Please sign in to comment.