[other] add to readme local run steps (#1104) #84
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: Build and Push | |
on: push | |
env: | |
NODE_VERSION: 18 | |
JAVA_VERSION: 11 | |
JAVA_DISTRIBUTION: 'adopt' | |
jobs: | |
build-push: | |
name: run tests, build and push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Install branch-github-actions | |
uses: actions/checkout@v4 | |
with: | |
repository: BranchMetrics/branch-github-actions | |
ref: master | |
path: .branch-github-actions | |
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }} | |
- name: Add INPUT_SHA env var | |
run: | | |
export INPUT_SHA=$(git rev-parse ${{ github.ref }}) | |
echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV | |
- name: Get next release version | |
uses: actions/github-script@v7 | |
id: next-version | |
with: | |
result-encoding: string | |
script: | | |
const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version'); | |
const nextVersion = await getNextVersion({ | |
core, | |
github, | |
context, | |
sha: process.env.INPUT_SHA, | |
}); | |
return nextVersion; | |
env: | |
INPUT_SHA: ${{ env.INPUT_SHA }} | |
- name: Write version to files | |
run: | | |
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }} | |
- name: Install dependencies | |
run: npm run ci | |
- name: Lint tests | |
run: npm run lint | |
- name: Run tests | |
run: npm run test-report | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: Unit Tests | |
fail-on-error: true, | |
path: test-results.json # Path to test results | |
reporter: mocha-json # Format of test results | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
id: test-results | |
if: always() | |
with: | |
files: "test-results.json" | |
- name: Run coverage | |
run: npm run cover | |
- name: upload codecov | |
uses: codecov/codecov-action@v4 | |
- name: Check whether we will be able to make the release | |
run: make release | |
- name: AWS, credentials setup | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-west-1 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Deploy updated builds to staging | |
if: ${{ github.ref == 'refs/heads/main' }} | |
id: build | |
run: | | |
./deployment/deploy-qa.sh |