|
| 1 | +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
| 3 | + |
| 4 | +name: Create Preview release |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: ['v3.*-preview.*'] |
| 8 | + |
| 9 | +jobs: |
| 10 | + version: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + outputs: |
| 14 | + latest-version: ${{steps.latest-version.outputs.version}} |
| 15 | + package-version: ${{steps.package-version.outputs.current-version}} |
| 16 | + |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + node-version: [16.x] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Use Node.js ${{ matrix.node-version }} |
| 25 | + uses: actions/setup-node@v1 |
| 26 | + with: |
| 27 | + node-version: ${{ matrix.node-version }} |
| 28 | + registry-url: 'https://registry.npmjs.org' |
| 29 | + |
| 30 | + - name: Get latest version from npm |
| 31 | + id: latest-version |
| 32 | + run: echo ::set-output name=version::$(npm show @microsoft/mgt version) |
| 33 | + |
| 34 | + - name: Get current package version |
| 35 | + id: package-version |
| 36 | + uses: martinbeentjes/npm-get-version-action@master |
| 37 | + |
| 38 | + release: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: version |
| 41 | + if: needs.version.outputs.latest-version != needs.version.outputs.package-version |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + node-version: [16.x] |
| 45 | + |
| 46 | + environment: |
| 47 | + name: release |
| 48 | + |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v2 |
| 51 | + |
| 52 | + - name: Use Node.js ${{ matrix.node-version }} |
| 53 | + uses: actions/setup-node@v1 |
| 54 | + with: |
| 55 | + node-version: ${{ matrix.node-version }} |
| 56 | + registry-url: 'https://registry.npmjs.org' |
| 57 | + |
| 58 | + - name: Install Dependencies |
| 59 | + run: | |
| 60 | + npm install -g yarn lerna |
| 61 | + yarn |
| 62 | +
|
| 63 | + - name: Update package version |
| 64 | + run: node scripts/setVersion.js |
| 65 | + |
| 66 | + - name: Build 🛠 |
| 67 | + run: yarn build |
| 68 | + |
| 69 | + - name: Publish npm packages |
| 70 | + run: lerna exec --scope @microsoft/* -- "npm publish --access=public" |
| 71 | + env: |
| 72 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 73 | + |
| 74 | + - name: Attach mgt-spfx solution to GitHub release |
| 75 | + run: node scripts/uploadSpfxSolution.js ${{secrets.GITHUB_TOKEN}} ${{needs.version.outputs.package-version}} |
| 76 | + |
| 77 | + - name: ReleaseNotes |
| 78 | + uses: anton-yurchenko/[email protected] |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + DRAFT_RELEASE: 'true' |
| 82 | + PRE_RELEASE: 'true' |
| 83 | + CHANGELOG_FILE: 'CHANGELOG.md' |
| 84 | + ALLOW_EMPTY_CHANGELOG: 'true' |
0 commit comments