diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2f6b52f..ba4fda8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,6 +1,13 @@ name: continuous-integration -on: [push, pull_request] +# Only run for pushes to a branch, not to a tag +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' jobs: build-and-test: @@ -16,4 +23,3 @@ jobs: - run: yarn - run: yarn build - run: yarn test - diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..38a891a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,65 @@ +name: deploy + +on: + push: + tags: + - '*.*.*' + +env: + OWNER: scala + REPOSITORY: vscode-scala-syntax + RELEASE_BRANCH: master + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + path: "**/node_modules" + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - run: yarn + + - name: Update package.json version + run: yarn version --no-git-tag-version --new-version ${GITHUB_REF#refs/*/} + - name: Generate CHANGELOG.md + run: npx github-changes --owner $OWNER --repository $REPOSITORY --branch $RELEASE_BRANCH --no-merges --title "Scala Syntax (official) Changelog" + - run: yarn build + - run: yarn test + - name: Commit generated files + run: | + git config --global user.name "Scala bot" + git config --global user.email "$GITHUB_RUN_NUMBER@$GITHUB_SHA" + git commit -am "Release ${GITHUB_REF#refs/*/}" + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY + git push origin HEAD:$RELEASE_BRANCH + + - name: Release extension + run: yarn vscode:publish --pat ${{ secrets.VS_MARKETPLACE_TOKEN }} + + - name: Generate GitHub Release notes + run: npx github-changes --owner $OWNER --repository $REPOSITORY --branch $RELEASE_BRANCH --no-merges --title "Changelog" --for-tag ${GITHUB_REF#refs/*/} --file release-notes.md + - name: Create GitHub Release + id: create-release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body_path: release-notes.md + draft: false + prerelease: false + - run: mv scala-*.vsix scala.vsix + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: ./scala.vsix + asset_name: scala.vsix + asset_content_type: application/zip diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 37acc65..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: node_js -node_js: - - "lts/*" - -stages: - - name: build - - name: release - if: tag IS present - -jobs: - include: - - stage: build - script: yarn build && yarn test - - stage: release - script: bin/ci-release.sh - deploy: - provider: releases - skip_cleanup: true - file_glob: true - file: scala-*.vsix - api_key: - secure: Gwd3nyoQSSZZTMrH8LgD4gwzXjfaPjQfrsFVvtSvoV+xcDI79crg0YQ2mClmVCnKAch6Pup/T84Os9swPKWcKJeHnZ2PxFA5FlIp4iZH5CbEODz9R7Pxqwq/qGqkAZOzr/K7W4g2NEs21IbcJKxsWlhlRhH+1m2iR397zleWduy3pkzJI0SqrdcRy34otYoCovxztnf47VmOq49HhfQdnYbOdtQTsDLJrtB7G1xXnWtDLCkFLOM1D2/bNeWaHOaSXO8hXGdC9EoAjMdmG4gauBp0VmXgHy9y+7dY0QBgFUcJdDDIfVURiiLPD/ka1/6JPigvYxPMbkXOZq8Io/3p6fZMBrtO8nqVvQKTTezU3d4GQ3zITZ84pol574MrR5gst0m9ph8gdYCNCGaJ6MZXGj/cYyIx5vswSBudK7jW75vpQyFW5iv9XE4gO9A0QsrutsIq6fe/WSNekDySHdWNdQ+JbtzK+BiyAFzu3YepytNYY2Bk8c71UpY5FUx2kkbZbLR8wGVipKn3U5W8azXFBWFRRO6yYYEXp/pcv/uCK4io9FNLotiZeZuiTs4B6X3tba3ZuV0XUI1lIwl3B+JQPggNVIH897K3Ge77+rEKoKuTvQg78U9uw41h4IjdHIjRT0aEQ+MWXj/O8Jo17B1XQvoBYdc4C9vtGW4NmmR+hmw= - on: - repo: scala/vscode-scala-syntax - all_branches: true - -cache: yarn diff --git a/README.md b/README.md index 374c9e4..4bee97c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![Install extension](https://img.shields.io/badge/scala-vscode-blue.png)](vscode:extension/scala-lang.scala) [![Version](https://img.shields.io/github/package-json/v/scala/vscode-scala-syntax.svg)](https://marketplace.visualstudio.com/items?itemName=scala-lang.scala) -[![Travis Build Status](https://travis-ci.org/scala/vscode-scala-syntax.svg?branch=master)](//travis-ci.org/scala/vscode-scala-syntax) ![GitHub Actions Build Status](https://github.com/scala/vscode-scala-syntax/workflows/continuous-integration/badge.svg) Visual Studio Code extension providing syntax highlighting for Scala 2 and Scala 3 source files. diff --git a/bin/ci-release.sh b/bin/ci-release.sh deleted file mode 100755 index f3d1ec7..0000000 --- a/bin/ci-release.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -set -eu - -DEPLOY_KEY=${GITHUB_DEPLOY_KEY:-} -NEW_VERSION=${TRAVIS_TAG#"v"} - -# Build the extension -yarn install -yarn build:syntax -yarn test - -# Update package.json and CHANGELOG.md -set-up-ssh() { - echo "Setting up ssh..." - mkdir -p $HOME/.ssh - ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts - git config --global user.name "Scala bot" - git config --global user.email "$TRAVIS_BUILD_NUMBER@$TRAVIS_COMMIT" - git config --global push.default simple - DEPLOY_KEY_FILE=$HOME/.ssh/id_rsa - echo "$GITHUB_DEPLOY_KEY" | base64 --decode > ${DEPLOY_KEY_FILE} - chmod 600 ${DEPLOY_KEY_FILE} - eval "$(ssh-agent -s)" - ssh-add ${DEPLOY_KEY_FILE} -} -if [[ -n "$DEPLOY_KEY" ]]; then - set-up-ssh -fi -git checkout -b travis-temp -yarn version --no-git-tag-version --new-version $NEW_VERSION -npx github-changes -o scala -r vscode-scala-syntax --no-merges -t "Scala Syntax (official) Changelog" -k $GITHUB_TOKEN -git commit -am "Update release notes for $TRAVIS_TAG" -git remote remove origin -git remote add origin git@github.com:scala/vscode-scala-syntax.git -git push origin HEAD:master - -# Publish to VS Code Marketplace -yarn vscode:publish -p $VS_MARKETPLACE_TOKEN