Merge "Build and Test" and "Publish" release jobs (#12818)

This commit is contained in:
Nicolò Ribaudo 2021-02-19 16:00:55 +01:00 committed by GitHub
parent af2ed36535
commit 1387d66e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,24 +31,6 @@ jobs:
git diff --name-only HEAD^..HEAD git diff --name-only HEAD^..HEAD
fi; fi;
build:
name: Build and Test
runs-on: ubuntu-latest
needs: log-updates
steps:
- uses: actions/checkout@v2
- name: Build and Test
run: make prepublish
- uses: actions/upload-artifact@v2
with:
name: build-artifact
path: |
codemods/*/**/*
eslint/*/**/*
packages/*/**/*
!**/test/**
!**/node_modules/**
git-version: git-version:
name: Create git tag and commit name: Create git tag and commit
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -79,14 +61,13 @@ jobs:
git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:"$branch" --follow-tags git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:"$branch" --follow-tags
npm-release: npm-release:
name: Publish release on npm name: Build, Test and Publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [git-version, build] needs: git-version
environment: npm environment: npm
# The default condition is success(), but this is false when one of the previous jobs is skipped # The default condition is success(), but this is false when one of the previous jobs is skipped
if: | if: |
always() && always() &&
needs.build.result == 'success' &&
(needs.git-version.result == 'success' || needs.git-version.result == 'skipped') (needs.git-version.result == 'success' || needs.git-version.result == 'skipped')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -96,9 +77,8 @@ jobs:
if: needs.git-version.result == 'success' if: needs.git-version.result == 'success'
run: git checkout ${{ needs.git-version.outputs.branch }} run: git checkout ${{ needs.git-version.outputs.branch }}
- uses: actions/download-artifact@v2 - name: Build and Test
with: run: make prepublish
name: build-artifact
- name: Publish to npm - name: Publish to npm
run: yarn release-tool publish --yes run: yarn release-tool publish --yes
@ -108,11 +88,10 @@ jobs:
github-release: github-release:
name: Create GitHub release draft name: Create GitHub release draft
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [git-version, build] needs: git-version
# The default condition is success(), but this is false when one of the previous jobs is skipped # The default condition is success(), but this is false when one of the previous jobs is skipped
if: | if: |
always() && always() &&
needs.build.result == 'success' &&
(needs.git-version.result == 'success' || needs.git-version.result == 'skipped') (needs.git-version.result == 'success' || needs.git-version.result == 'skipped')
outputs: outputs:
is-main: ${{ steps.is-main.outputs.result == 1 }} is-main: ${{ steps.is-main.outputs.result == 1 }}