|
| 1 | +name: deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*.*.*' |
| 7 | + |
| 8 | +env: |
| 9 | + OWNER: scala |
| 10 | + REPOSITORY: vscode-scala-syntax |
| 11 | + RELEASE_BRANCH: master |
| 12 | + |
| 13 | +jobs: |
| 14 | + deploy: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + - uses: actions/setup-node@v1 |
| 19 | + - name: Cache Node.js modules |
| 20 | + uses: actions/cache@v2 |
| 21 | + with: |
| 22 | + path: "**/node_modules" |
| 23 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 24 | + - run: yarn |
| 25 | + |
| 26 | + - name: Update package.json version |
| 27 | + run: yarn version --no-git-tag-version --new-version ${GITHUB_REF#refs/*/} |
| 28 | + - name: Generate CHANGELOG.md |
| 29 | + run: npx github-changes --owner $OWNER --repository $REPOSITORY --branch $RELEASE_BRANCH --no-merges --title "Scala Syntax (official) Changelog" |
| 30 | + - run: yarn build |
| 31 | + - run: yarn test |
| 32 | + - name: Commit generated files |
| 33 | + run: | |
| 34 | + git config --global user.name "Scala bot" |
| 35 | + git config --global user.email "$GITHUB_RUN_NUMBER@$GITHUB_SHA" |
| 36 | + git commit -am "Release ${GITHUB_REF#refs/*/}" |
| 37 | + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY |
| 38 | + git push origin HEAD:$RELEASE_BRANCH |
| 39 | +
|
| 40 | + - name: Release extension |
| 41 | + run: yarn vscode:publish --pat ${{ secrets.VS_MARKETPLACE_TOKEN }} |
| 42 | + |
| 43 | + - name: Generate GitHub Release notes |
| 44 | + run: npx github-changes --owner $OWNER --repository $REPOSITORY --branch $RELEASE_BRANCH --no-merges --title "Changelog" --for-tag ${GITHUB_REF#refs/*/} --file release-notes.md |
| 45 | + - name: Create GitHub Release |
| 46 | + id: create-release |
| 47 | + uses: actions/create-release@v1 |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + with: |
| 51 | + tag_name: ${{ github.ref }} |
| 52 | + release_name: Release ${{ github.ref }} |
| 53 | + body_path: release-notes.md |
| 54 | + draft: false |
| 55 | + prerelease: false |
| 56 | + - run: mv scala-*.vsix scala.vsix |
| 57 | + - name: Upload Release Asset |
| 58 | + uses: actions/upload-release-asset@v1 |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + with: |
| 62 | + upload_url: ${{ steps.create-release.outputs.upload_url }} |
| 63 | + asset_path: ./scala.vsix |
| 64 | + asset_name: scala.vsix |
| 65 | + asset_content_type: application/zip |
0 commit comments