diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 3ffdec62..5e2c9e8a 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,4 +1,4 @@ -name: "Pull Request Labeler" +name: Pull Request Labeler on: pull_request_target: types: [opened] @@ -9,4 +9,4 @@ jobs: steps: - uses: ericcornelissen/labeler@label-based-on-status with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..f7abe6e1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,73 @@ +name: Publish +on: + push: + branches: + - master + +jobs: + npm: + name: NPM Package + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Install dependencies + run: npm ci + - name: Sanity check + run: | + npm run lint + npm run test + - name: Deploy to NPM + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + github: + name: GitHub release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Install dependencies + run: npm ci + - name: Sanity check + run: | + npm run lint + npm run test + - name: Get commit message (for release title and body) + id: commit + uses: kceb/git-message-action@v1 + - name: Get release title and body + id: release + run: | + RELEASE_TITLE=$(echo '${{ steps.commit.outputs.git-message }}' | head -n 1) + echo "::set-output name=title::$RELEASE_TITLE" + RELEASE_BODY=$(echo '${{ steps.commit.outputs.git-message }}' | tail -n $(expr $(echo '${{ steps.commit.outputs.git-message }}' | wc -l) - 1)) + echo "::set-output name=body::$RELEASE_BODY" + - name: Get release version + id: get_version + run: | + export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//') + echo "::set-output name=version::$PACKAGE_VERSION" + - name: Create and push git tag + uses: actions-ecosystem/action-push-tag@v1 + with: + tag: ${{ steps.get_version.outputs.version }} + message: ${{ steps.commit.outputs.git-message }} + - name: Create release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.get_version.outputs.version }} + release_name: ${{ steps.release.outputs.title }} + body: ${{ steps.release.outputs.body }} + draft: false + prerelease: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5aa4b0cd..46407af2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: "Automated releases" +name: Automated releases on: pull_request_review: types: [submitted] @@ -13,4 +13,4 @@ jobs: steps: - uses: simple-icons/release-action@master with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 00000000..b7d4d49d --- /dev/null +++ b/.github/workflows/verify.yml @@ -0,0 +1,60 @@ +name: Verify +on: [pull_request, push] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Install dependencies + run: npm ci + - name: Run linter + run: | + npm run jsonlint + npm run svglint + npm run wslint + npm run our-lint + build: + name: Build website + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use Ruby 2.5 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.5 + - name: Setup cache for gems + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Install Jekyll + run: | + echo -e 'source "https://rubygems.org"\n\ngem "jekyll"' > Gemfile + bundle config set path 'vendor/bundle' + bundle install --jobs 4 --retry 3 + - name: Build website + run: bundle exec jekyll build + test: + name: Test package + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Install dependencies + run: npm ci + - name: Run tests + run: npm run test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 961eff44..00000000 --- a/.travis.yml +++ /dev/null @@ -1,71 +0,0 @@ -os: linux - -jobs: - include: - - stage: "Test" - name: "Lint" - language: node_js - node_js: 12 - git: - depth: 1 - script: - - npm run jsonlint - - npm run svglint - - npm run wslint - - npm run our-lint - - name: "Build website" - language: ruby - rvm: 2.5.3 - git: - depth: 1 - cache: - directories: - - /home/travis/.rvm/ - install: - - gem install jekyll - script: - - jekyll build - - name: "Test package" - language: node_js - node_js: 12 - git: - depth: 1 - script: - - npm run test - - - stage: "Deploy" - name: "Git tag" - language: shell - git: - depth: 1 - if: branch = master - - before_deploy: - - git config --local user.name "$GITHUB_USERNAME" - - git config --local user.email "$GITHUB_EMAIL" - - export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//') - - git tag $PACKAGE_VERSION - deploy: - provider: releases - token: "$GITHUB_TOKEN" - cleanup: false - - name: "NPM Package" - language: node_js - node_js: 12 - git: - depth: 1 - if: branch = master - - deploy: - edge: true - provider: npm - email: "$NPM_EMAIL" - api_token: "$NPM_KEY" - cleanup: false - on: - branch: master - -notifications: - email: - on_success: never - on_failure: change diff --git a/README.md b/README.md index 0e732168..80b37f56 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,6 @@ Icons are also available as a [WordPress plugin](https://wordpress.org/plugins/s ## Status -[![Build Status](https://travis-ci.com/simple-icons/simple-icons.svg?branch=develop)](https://travis-ci.com/simple-icons/simple-icons) +[![Build status](https://github.com/simple-icons/simple-icons/workflows/Verify/badge.svg)](https://github.com/simple-icons/simple-icons/actions?query=workflow%3AVerify+branch%3Adevelop) [![npm version](https://img.shields.io/npm/v/simple-icons.svg)](https://www.npmjs.com/package/simple-icons) [![Packagist version](https://img.shields.io/packagist/v/simple-icons/simple-icons)](https://packagist.org/packages/simple-icons/simple-icons)