Skip to content

Commit

Permalink
Merge pull request #7 from DeschutesDesignGroupLLC/add-versioning-fea…
Browse files Browse the repository at this point in the history
…ture

Add versioning to widget
  • Loading branch information
jonerickson authored Jan 30, 2023
2 parents ece35ad + ddc2350 commit 83ede9e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,30 @@ jobs:
- name: Run Linter
run: npm run lint

- name: Bump Application Version and Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
default_prerelease_bump: prerelease
release_branches: master
pre_release_branches: prerelease
append_to_pre_release_tag: prerelease

- name: Build Application for Staging
if: github.ref == 'refs/heads/prerelease'
run: npm run build:widget
env:
REACT_APP_API_URL: https://api.staging.perscom.io/v1/widget/roster
REACT_APP_WIDGET_VERSION: ${{ steps.tag_version.outputs.new_tag }}

- name: Build Application for Production
if: github.ref == 'refs/heads/master'
run: npm run build:widget
env:
REACT_APP_API_URL: https://api.perscom.io/v1/widget/roster
REACT_APP_WIDGET_VERSION: ${{ steps.tag_version.outputs.new_tag }}

- name: Setup AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -45,17 +58,6 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Bump Application Version and Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
default_prerelease_bump: prerelease
release_branches: master
pre_release_branches: prerelease
append_to_pre_release_tag: prerelease

- name: Deploy to S3 Staging
if: github.ref == 'refs/heads/prerelease'
run: aws s3 sync ./dist/ s3://${{ secrets.AWS_BUCKET_NAME_STAGING }} --delete
Expand All @@ -73,7 +75,16 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Create Release
- name: Create Staging Release
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/prerelease'
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
prerelease: true

- name: Create Production Release
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/master'
with:
Expand Down
7 changes: 5 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const url = {
const constants = {
version: {
WIDGET_VERSION: process.env.REACT_APP_WIDGET_VERSION
},
roster: {
API_URL: process.env.REACT_APP_API_URL
}
}

export const config = url
export const config = constants
3 changes: 2 additions & 1 deletion src/pages/Roster.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function Roster({ domElement }) {
const [loading, setLoading] = useState()
const [error, setError] = useState('')
const [data, setData] = useState([])
const version = config.version.WIDGET_VERSION

useEffect(() => {
setLoading(true)
Expand Down Expand Up @@ -61,7 +62,7 @@ function Roster({ domElement }) {
<a href='https://perscom.io' target='_blank' rel='noreferrer'>
PERSCOM.io
</a>
. Copyright {new Date().getFullYear()} Deschutes Design Group LLC
. Copyright {new Date().getFullYear()} Deschutes Design Group LLC. {version && <span>Version {version}.</span>}
</div>
</div>
)}
Expand Down

0 comments on commit 83ede9e

Please sign in to comment.