Skip to content

Commit

Permalink
[patch] fix gha for pushing to stage
Browse files Browse the repository at this point in the history
  • Loading branch information
bredmond5 committed Nov 5, 2024
1 parent fa7fed4 commit 0160713
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 244 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Deploy Staging
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 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: bash ${GITHUB_WORKSPACE}/deployment/build-test.sh

- name: AWS, credentials setup
# if: ${{ github.ref == 'refs/heads/master' }}
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/master' }}
id: build
run: |
./deployment/deploy-qa.sh
93 changes: 0 additions & 93 deletions .github/workflows/deploy-qa.yml

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/gate-keep.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/test.yml

This file was deleted.

3 changes: 2 additions & 1 deletion deployment/deploy-qa.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ NC='\033[0m'

echo -en "${GREEN}Pushing to CDN ...${NC}\n"
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-staging-latest.min.js --cache-control "max-age=300"
aws s3 cp dist/example.html s3://branch-cdn/example-staging.html
aws s3 cp example.html s3://branch-cdn/example-staging.html

echo -en "Invalidating cloudfront distribution for staging ...\n"
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id E10P37NG0GMER --paths /branch-staging-latest.min.js /example-staging

# Exit prompts
echo -en "${GREEN}Done deploy QA script ...${NC}\n"
4 changes: 2 additions & 2 deletions dev.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"APIEndpoint": "https://api2.branch.io",
"sdkKey": null,
"APIEndpoint": "https://api.stage.branch.io",
"sdkKey": "key_live_feebgAAhbH9Tv85H5wLQhpdaefiZv5Dv",
"port": "3000"
}

0 comments on commit 0160713

Please sign in to comment.