force #96
Workflow file for this run
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 Release Publish | |
on: [push] | |
jobs: | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get yarn cache | |
id: yarn-cache | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "dir<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(yarn cache dir)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ubuntu-latest-node-18.x-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
ubuntu-latest-node-18.x-yarn- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org/ | |
- name: Install | |
run: yarn install --frozen-lockfile | |
- name: Lint | |
run: yarn lint | |
- name: Test | |
run: yarn test --ci --bail | |
- uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./coverage | |
release_publish: | |
name: publish | |
runs-on: ubuntu-latest | |
needs: test | |
if: success() && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get yarn cache | |
id: yarn-cache | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "dir<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(yarn cache dir)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ubuntu-latest-node-18.x-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
ubuntu-latest-node-18.x-yarn- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org/ | |
- name: Install | |
run: yarn install --frozen-lockfile | |
- name: Setup env vars | |
id: ownEnvVars | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
# Set PACKAGE_VERSION | |
PACKAGE_VERSION=$(node -p -e "require('./package.json').version") | |
echo "PACKAGE_VERSION<<$EOF" >> $GITHUB_OUTPUT | |
echo "$PACKAGE_VERSION" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
# Set COMMIT_LOG | |
COMMIT_LOG=`git log $(git describe --tags --abbrev=0)..HEAD --date=iso-local --format='%cd %h %an - %s '` | |
echo "COMMIT_LOG<<$EOF" >> $GITHUB_OUTPUT | |
echo "$COMMIT_LOG" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: npm publish | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.ownEnvVars.outputs.PACKAGE_VERSION }} | |
commit: main | |
body: ${{ steps.ownEnvVars.outputs.COMMIT_LOG }} | |
- name: Create JIRA release | |
uses: darioblanco/jira-wizard@main | |
with: | |
app: ${{ github.repository }} | |
host: ${{ secrets.JIRA_HOST }} | |
email: ${{ secrets.JIRA_EMAIL }} | |
apiToken: ${{ secrets.JIRA_API_TOKEN }} | |
projectKey: ${{ secrets.JIRA_PROJECT_KEY }} | |
version: ${{ steps.ownEnvVars.outputs.PACKAGE_VERSION }} | |
draft: false | |
- name: Slack Notification - NPM release | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE_BOT_PUBLIC }} | |
SLACK_USERNAME: "npmBot" | |
SLACK_CHANNEL: "releases_npm" | |
SLACK_ICON: "https://avatars0.githubusercontent.com/u/6078720?s=32&v=4" | |
SLACK_MESSAGE: "📦 Released NPM package ${{github.repository}} https://github.com/${{github.repository}}/releases/tag/${{ steps.ownEnvVars.outputs.PACKAGE_VERSION }}" |