Skip to content

Commit

Permalink
ci: reuse organisation's workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
MrChocolatine committed Nov 1, 2021
1 parent aba1ba6 commit 8e768bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 144 deletions.
91 changes: 6 additions & 85 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,96 +1,17 @@
# GitHub Actions documentation:
# https://docs.github.com/en/actions

name: CI

on:
push:
branches:
- master
branches: master
pull_request: {}

env:
NODE_VERSION: 12

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

# https://github.com/lirantal/lockfile-lint
- name: Lint lockfile
run: >
npm_config_yes=true npx lockfile-lint
--path yarn.lock
--allowed-hosts npm yarn
--validate-https
- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn run lint

- name: Run Tests
run: yarn run test:ember

floating:
name: Floating Dependencies
needs: test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

- name: Install Dependencies
run: yarn install --no-lockfile --non-interactive

- name: Run Tests
run: yarn run test:ember

try-scenarios:
name: ${{ matrix.try-scenario }}
needs: test
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
try-scenario:
- ember-lts-3.16
- ember-lts-3.20
- ember-release
- ember-classic
- ember-default-with-jquery
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
org:
uses: peopledoc/.github/.github/workflows/emberjs-addons-ci.yml@add-reusable-workflow-emberjs-addon
68 changes: 9 additions & 59 deletions .github/workflows/tag-release-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GitHub Actions workflows:
# GitHub Actions documentation:
# https://docs.github.com/en/actions

name: Create new `git tag`, create new GitHub release and publish to NPM
Expand All @@ -9,63 +9,13 @@ on:
branches: master
types: completed

concurrency:
group: tag-release-publish-${{ github.ref }}
cancel-in-progress: true

jobs:
create-git-tag:
org:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Create new `git tag`
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
new-tag: ${{ steps.detect-and-tag-new-version.outputs.tag }}
new-version: ${{ steps.detect-and-tag-new-version.outputs.current-version }}
old-version: ${{ steps.detect-and-tag-new-version.outputs.previous-version }}
steps:
- uses: actions/checkout@v2
with:
# Required to ensure git history is properly checked:
# https://github.com/salsify/action-detect-and-tag-new-version/blob/v2.0.1/README.md?plain=1#L11
fetch-depth: 2

- name: Detect and tag new version
id: detect-and-tag-new-version
uses: salsify/action-detect-and-tag-new-version@v2

create-github-release:
if: ${{ needs.create-git-tag.outputs.new-tag }}
name: Create new GitHub release
needs: create-git-tag
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: ncipollo/release-action@v1
env:
REPO_URL: '${{ github.server_url }}/${{ github.repository }}'
TAGS_DIFF: 'v${{ needs.create-git-tag.outputs.old-version }}...v${{ needs.create-git-tag.outputs.new-version }}'
with:
body: 'Changelog: ${{ env.REPO_URL }}/compare/${{ env.TAGS_DIFF }}'
name: Release ${{ needs.create-git-tag.outputs.new-tag }}
tag: ${{ needs.create-git-tag.outputs.new-tag }}

publish-npm:
if: ${{ needs.create-git-tag.outputs.new-tag }}
name: Publish to NPM
needs: create-git-tag
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 12
# Required if we want to authenticate during the `npm publish`:
# https://github.com/actions/setup-node/blob/v2.4.1/action.yml#L15-L16
registry-url: https://registry.npmjs.org

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
uses: peopledoc/.github/.github/workflows/emberjs-addons-tag-release-publish.yml@add-reusable-workflow-emberjs-addon
secrets:
npm_automation_token: ${{ secrets.NPM_AUTOMATION_TOKEN }}

0 comments on commit 8e768bb

Please sign in to comment.