From 144f850d9c8cd33ede763a66224dcba86f3fe967 Mon Sep 17 00:00:00 2001 From: derberg Date: Tue, 12 Jan 2021 12:18:55 +0100 Subject: [PATCH 1/3] ci: cleanup release workflow and add testing on all platforms --- .github/workflows/pull-request-testing.yml | 15 +++--- .github/workflows/release.yml | 55 +++++++++------------- package.json | 6 ++- 3 files changed, 35 insertions(+), 41 deletions(-) diff --git a/.github/workflows/pull-request-testing.yml b/.github/workflows/pull-request-testing.yml index aa3be21ad..22715ba13 100644 --- a/.github/workflows/pull-request-testing.yml +++ b/.github/workflows/pull-request-testing.yml @@ -7,10 +7,13 @@ on: jobs: test_pr: if: github.event.pull_request.draft == false - name: 'Testing pull request' - runs-on: ubuntu-latest + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] steps: - - name: Checkout repo + - name: Checkout repository uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v1 @@ -18,7 +21,7 @@ jobs: node-version: 14 - name: Install dependencies run: npm ci + - name: Test + run: npm test - name: Run linter - run: npm run lint - - name: Run tests - run: npm test \ No newline at end of file + run: npm run lint \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60ed1831b..3b2191571 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,11 +6,31 @@ on: - master jobs: + + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 14 + - name: Install dependencies + run: npm ci + - name: Test + run: npm test + release: - name: 'Release NPM, GitHub' + needs: test + name: Release to NPM and GitHub runs-on: ubuntu-latest steps: - - name: Checkout repo + - name: Checkout repository uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v1 @@ -18,11 +38,6 @@ jobs: node-version: 14 - name: Install dependencies run: npm ci - - name: Run tests - run: npm test - - name: Get version from package.json before release step - id: initversion - run: echo "::set-output name=version::$(npm run get-version --silent)" - name: Release to NPM and GitHub id: release env: @@ -33,29 +48,3 @@ jobs: GIT_COMMITTER_NAME: asyncapi-bot GIT_COMMITTER_EMAIL: info@asyncapi.io run: npm run release - - name: Get version from package.json after release step - id: extractver - run: echo "::set-output name=version::$(npm run get-version --silent)" - - name: Create Pull Request with updated package files - if: steps.initversion.outputs.version != steps.extractver.outputs.version - uses: peter-evans/create-pull-request@v2.4.4 - with: - token: ${{ secrets.GH_TOKEN }} - commit-message: 'chore(release): ${{ steps.extractver.outputs.version }}' - committer: asyncapi-bot - author: asyncapi-bot - title: 'chore(release): ${{ steps.extractver.outputs.version }}' - body: 'Version bump in package.json and package-lock.json for release [${{ steps.extractver.outputs.version }}](https://github.com/${{github.repository}}/releases/tag/v${{ steps.extractver.outputs.version }})' - branch: version-bump/${{ steps.extractver.outputs.version }} - - name: Check if version changed # Version check based on package.json version number - uses: EndBug/version-check@v1.6.0 - id: check - - name: Publish information about the release to Twitter # tweet only if detected version change is not a patch - if: steps.check.outputs.changed == 'true' && steps.check.outputs.type != 'patch' - uses: m1ner79/Github-Twittction@v1.0.1 - with: - twitter_status: "Release ${{ steps.check.outputs.version }} for ${{github.repository}} is out in the wild 😱πŸ’ͺπŸΎπŸŽ‚\n\nThank you for the contribution ${{ github.event.commits[0].author.name }} https://github.com/${{github.repository}}/releases/tag/v${{ steps.check.outputs.version }}" - twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} - twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} - twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} - twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} diff --git a/package.json b/package.json index 8129d8aca..5e7876017 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,10 @@ "lint": "echo \"No linter specified yet\"", "test": "ava", "release": "semantic-release", - "get-version": "echo $npm_package_version", - "develop": "ag https://raw.githubusercontent.com/asyncapi/generator/v1.0.0-rc.12/test/docs/dummy.yml ./ -o test/output --force-write --watch-template" + "get:version": "echo $npm_package_version", + "develop": "ag https://raw.githubusercontent.com/asyncapi/generator/v1.0.0-rc.12/test/docs/dummy.yml ./ -o test/output --force-write --watch-template", + "generate:assets": "echo 'No additional assets need to be generated at the moment'", + "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" }, "publishConfig": { "access": "public" From 3acf3959db50637fddfd7f756b4ebb953edf392a Mon Sep 17 00:00:00 2001 From: derberg Date: Tue, 12 Jan 2021 19:57:43 +0100 Subject: [PATCH 2/3] remove workflows that will be managed centrally --- .github/workflows/pull-request-testing.yml | 27 ------------ .github/workflows/release.yml | 50 ---------------------- 2 files changed, 77 deletions(-) delete mode 100644 .github/workflows/pull-request-testing.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pull-request-testing.yml b/.github/workflows/pull-request-testing.yml deleted file mode 100644 index 22715ba13..000000000 --- a/.github/workflows/pull-request-testing.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Pull request testing - -on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - -jobs: - test_pr: - if: github.event.pull_request.draft == false - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Install dependencies - run: npm ci - - name: Test - run: npm test - - name: Run linter - run: npm run lint \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3b2191571..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Release - -on: - push: - branches: - - master - -jobs: - - test: - name: Test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Install dependencies - run: npm ci - - name: Test - run: npm test - - release: - needs: test - name: Release to NPM and GitHub - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Install dependencies - run: npm ci - - name: Release to NPM and GitHub - id: release - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - GIT_AUTHOR_NAME: asyncapi-bot - GIT_AUTHOR_EMAIL: info@asyncapi.io - GIT_COMMITTER_NAME: asyncapi-bot - GIT_COMMITTER_EMAIL: info@asyncapi.io - run: npm run release From 8f2726636638aeee6262c63c51ff75e9c298990f Mon Sep 17 00:00:00 2001 From: derberg Date: Wed, 20 Jan 2021 16:05:53 +0100 Subject: [PATCH 3/3] Update package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 5e7876017..f72ef425b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "lint": "echo \"No linter specified yet\"", "test": "ava", "release": "semantic-release", - "get:version": "echo $npm_package_version", "develop": "ag https://raw.githubusercontent.com/asyncapi/generator/v1.0.0-rc.12/test/docs/dummy.yml ./ -o test/output --force-write --watch-template", "generate:assets": "echo 'No additional assets need to be generated at the moment'", "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION"