|
| 1 | +name: Publish new release |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [closed] |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + release_gh: |
| 13 | + name: Create new GitHub release |
| 14 | + if: contains(github.event.pull_request.labels.*.name, 'release') |
| 15 | + |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Setup Node |
| 21 | + uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: '20.x' |
| 24 | + registry-url: 'https://registry.npmjs.org' |
| 25 | + |
| 26 | + - name: git config |
| 27 | + run: | |
| 28 | + git config user.name "${GITHUB_ACTOR}" |
| 29 | + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" |
| 30 | +
|
| 31 | + - name: Generate Changelog |
| 32 | + run: node ./scripts/extract_changelog.js > ${{ github.workspace }}-CURRENT_CHANGELOG.md |
| 33 | + |
| 34 | + - name: Get latest version |
| 35 | + run: echo "PACKAGE_VERSION=$(node scripts/extract_version.js)" >> $GITHUB_ENV |
| 36 | + |
| 37 | + - name: GitHub Release |
| 38 | + uses: softprops/action-gh-release@v2 |
| 39 | + with: |
| 40 | + name: freeRASP ${{ env.PACKAGE_VERSION }} |
| 41 | + tag_name: v${{ env.PACKAGE_VERSION }} |
| 42 | + body_path: ${{ github.workspace }}-CURRENT_CHANGELOG.md |
| 43 | + |
| 44 | + publish_npmjs: |
| 45 | + name: Publish release to npm.js |
| 46 | + needs: release_gh |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Setup Node |
| 52 | + uses: actions/setup-node@v4 |
| 53 | + with: |
| 54 | + node-version: '20.x' |
| 55 | + registry-url: 'https://registry.npmjs.org' |
| 56 | + node-version-file: .nvmrc |
| 57 | + |
| 58 | + - name: Cache dependencies |
| 59 | + id: yarn-cache |
| 60 | + uses: actions/cache@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + **/node_modules |
| 64 | + .yarn/install-state.gz |
| 65 | + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }} |
| 66 | + restore-keys: | |
| 67 | + ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} |
| 68 | + ${{ runner.os }}-yarn- |
| 69 | +
|
| 70 | + - name: Install dependencies |
| 71 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 72 | + run: yarn install --immutable |
| 73 | + shell: bash |
| 74 | + |
| 75 | + - name: Build Expo plugin |
| 76 | + working-directory: ./plugin |
| 77 | + run: tsc |
| 78 | + shell: bash |
| 79 | + |
| 80 | + - name: Configure git |
| 81 | + run: | |
| 82 | + git config user.name "${GITHUB_ACTOR}" |
| 83 | + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" |
| 84 | + |
| 85 | + - name: Publish package |
| 86 | + run: npm publish |
| 87 | + env: |
| 88 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments