This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test, Build & Publish | |
on: | |
create: | |
tags: '**' | |
push: | |
branches: '**' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: npm install, build | |
run: | | |
npm install | |
./node_modules/.bin/tsc | |
env: | |
CI: true | |
- name: Run test component | |
run: mv test-folders/component-tests tests && ./node_modules/.bin/ember test | |
- name: Run test helpers | |
run: rm -rf tests && mv test-folders/helper-tests tests && ./node_modules/.bin/ember test | |
- name: Run test modifiers | |
run: rm -rf tests && mv test-folders/modifier-tests tests && ./node_modules/.bin/ember test | |
- name: Run tests mixed | |
run: rm -rf tests && mv test-folders/mixed-tests tests && ./node_modules/.bin/ember test | |
ember-try: | |
name: ember-try (${{ matrix.scenario }}) | |
needs: test | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
env: | |
CI: 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
experimental: [false] | |
scenario: | |
- release | |
include: | |
- scenario: beta | |
experimental: true | |
- scenario: canary | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Install dependencies (npm) | |
run: npm install && ./node_modules/.bin/tsc | |
- name: Setup ember-try scenario | |
run: ./node_modules/.bin/ember try:one ember-${{ matrix.scenario }} --skip-cleanup --- cat package.json | |
- name: Run test component | |
run: mv test-folders/component-tests tests && ./node_modules/.bin/ember test | |
- name: Run test helpers | |
run: rm -rf tests && mv test-folders/helper-tests tests && ./node_modules/.bin/ember test | |
- name: Run test modifiers | |
run: rm -rf tests && mv test-folders/modifier-tests tests && ./node_modules/.bin/ember test | |
- name: Run tests mixed | |
run: rm -rf tests && mv test-folders/mixed-tests tests && ./node_modules/.bin/ember test | |
deploy: | |
needs: [test, ember-try] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: npm install, build, and deploy docs | |
run: | | |
mkdir ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
npm install | |
./node_modules/.bin/tsc | |
env: | |
CI: true | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
- name: deploy npm | |
if: github.ref == 'refs/heads/main' | |
run: | | |
version=$(cat package.json | jq -r '.version') | |
TAG=v$version | |
if git rev-parse "$TAG" >/dev/null 2>&1; then | |
echo "tag exists"; | |
else | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
npm publish || echo "already published" | |
fi | |
env: | |
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" | |
- name: create tag | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_COMMIT: ${{ github.sha }} | |
run: | | |
version=$(cat package.json | jq -r '.version') | |
TAG=v$version | |
if git rev-parse "$TAG" >/dev/null 2>&1; then | |
echo "tag exists"; | |
else | |
curl -X POST -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/patricklx/ember-hbs-imports/git/refs -d "{ \"ref\": \"refs/tags/$TAG\", \"sha\": \"$GITHUB_COMMIT\" }" | |
fi | |
- name: Create a Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
version=$(cat package.json | jq -r '.version') | |
TAG=v$version | |
url="https://api.github.com/repos/patricklx/ember-hbs-imports/releases" | |
exists=$(curl -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" $url | jq ".[] | select(.tag_name == \"$TAG\") | .id") | |
if [[ -z $exists ]]; then | |
npm i lerna-changelog || echo "its okay" | |
export GITHUB_AUTH=$GITHUB_TOKEN | |
changelog=$(./node_modules/.bin/lerna-changelog) | |
curl -X POST -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" $url -d "{ \"tag_name\": \"$TAG\", \"name\": \"$TAG\", \"body\": \"$changelog\", \"draft\": false, \"prerelease\": false}" | |
else | |
echo "release already exists"; | |
fi; |