From 6f5ea31a1b37bf0fa84965a53621216b062ea737 Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Fri, 12 Mar 2021 01:18:36 +0100 Subject: [PATCH] On tag publish with GitHub Actions (GitHub Release + NPM) (#334) --- .github/workflows/ci.yml | 36 +++++++++++++++++++++-- .travis.yml | 63 ---------------------------------------- appveyor.yml | 33 --------------------- package.json | 3 +- 4 files changed, 34 insertions(+), 101 deletions(-) delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80c61803..47c4f1a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,8 @@ name: CI on: push: branches: [ master ] - # run when tag received matching version format + tags: + - v*.*.* pull_request: branches: [ master ] @@ -90,5 +91,34 @@ jobs: ls prebuilds/ name: List prebuilds - # only if tag found for release - #- if defined APPVEYOR_REPO_TAG_NAME (npm run upload) + - name: Upload prebuilds to GitHub + run: npm run upload + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + env: + GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Separate step for publishing to NPM so we're sure that generating + uploading prebuilds worked on all platforms + npm-publish: + needs: build + name: Publish to NPM + runs-on: ubuntu-20.04 + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 15 + uses: actions/setup-node@v1 + with: + node-version: 15.x + registry-url: 'https://registry.npmjs.org' + + - run: sudo apt-get install libsecret-1-dev + name: Install additional dependencies + + - run: npm install + name: Setup environment + + - run: npm publish --access public + name: Upload to NPM + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1dde81cb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -language: node_js -sudo: required -dist: trusty -os: - - linux - - osx -node_js: 15 - -env: - - CC=clang CXX=clang++ npm_config_clang=1 - -notifications: - email: false - -git: - depth: 10 - -branches: - only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - -services: - - docker - -cache: - directories: - - node_modules - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - xvfb - - gnome-keyring - - libsecret-1-dev - - python-gnomekeyring - -before_script: - - | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - dbus-launch /usr/bin/python -c \ - "import gnomekeyring;gnomekeyring.create_sync('login', '');" - fi - -install: - - npm install - -script: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then xvfb-run ./script/cibuild; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then npm test; fi - - npm run prebuild-node - - npm run prebuild-electron - - | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - mkdir -p prebuilds && chmod 777 prebuilds - docker build -t node-keytar/i386 docker/i386 - docker run --rm -v ${PWD}:/project node-keytar/i386 /bin/bash -c "cd /project && npm run prebuild-node-ia32 && npm run prebuild-electron-ia32 && rm -rf build" - docker build -t node-keytar/arm64-cross-compile docker/arm64-cross-compile - docker run --rm -v ${PWD}:/project node-keytar/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-electron-arm64" - fi - - if [[ -n "$TRAVIS_TAG" ]]; then npm run upload; fi diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2a85a35a..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: "{build}" - -image: Visual Studio 2017 -platform: - - x64 - -environment: - nodejs_version: "15" - -cache: - - node_modules - -branches: - only: - - /master|^v\d+\.\d+\.\d+?(-\S*)?$/ - -clone_depth: 10 - -install: - - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM - - npm install - -build_script: - - npm test - - npm run prebuild-node - - npm run prebuild-node-ia32 - - npm run prebuild-electron - - npm run prebuild-electron-ia32 - - npm run prebuild-electron-arm64 - - if defined APPVEYOR_REPO_TAG_NAME (npm run upload) - -test: off -deploy: off diff --git a/package.json b/package.json index 89fd2c89..86f864ef 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,7 @@ "prebuild-electron": "prebuild -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -r electron --strip", "prebuild-electron-arm64": "prebuild -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -r electron -a arm64 --strip", "prebuild-electron-ia32": "prebuild -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -r electron -a ia32 --strip", - "upload": "node ./script/upload.js", - "postpublish": "git push --follow-tags" + "upload": "node ./script/upload.js" }, "devDependencies": { "babel-core": "^6.26.3",