Merge pull request #16545 from CDCgov/deployment/2024-11-14 #3403
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: Release to GitHub | |
on: | |
push: | |
branches: | |
- main | |
- production | |
concurrency: ${{ github.ref }}-gh-release | |
jobs: | |
wf_vars: | |
name: Set workflow variables | |
runs-on: ubuntu-latest | |
outputs: | |
env_name: ${{ steps.build_vars.outputs.env_name }} | |
version: ${{ steps.build_vars.outputs.version }} | |
prerelease: ${{ steps.build_vars.outputs.prerelease }} | |
enable_builds: 'true' | |
steps: | |
- name: Check out changes | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
with: | |
fetch-depth: 0 | |
- name: Build vars | |
id: build_vars | |
uses: ./.github/actions/build-vars | |
build_router: | |
name: Build router | |
needs: | |
- wf_vars | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: prime-router | |
steps: | |
- name: Check out changes | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
- name: Build backend | |
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }} | |
uses: ./.github/actions/build-backend | |
with: | |
version: ${{ needs.wf_vars.outputs.version }} | |
build_frontend: | |
name: Build frontend | |
needs: | |
- wf_vars | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: frontend-react | |
steps: | |
- name: Check out changes | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
- name: Build frontend | |
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }} | |
uses: ./.github/actions/build-frontend | |
with: | |
env-name: ${{ needs.wf_vars.outputs.env_name }} | |
appinsights-staging-key: ${{ secrets.APPINSIGHTS_STAGING_KEY }} | |
appinsights-prod-key: ${{ secrets.APPINSIGHTS_PROD_KEY }} | |
version: ${{ needs.wf_vars.outputs.version }} | |
test-admin-user: ${{ secrets.TEST_ADMIN_USERNAME }} | |
test-admin-password: ${{ secrets.TEST_ADMIN_PASSWORD }} | |
test-sender-user: ${{ secrets.TEST_SENDER_USERNAME }} | |
test-sender-password: ${{ secrets.TEST_SENDER_PASSWORD }} | |
test-receiver-user: ${{ secrets.TEST_RECEIVER_USERNAME }} | |
test-receiver-password: ${{ secrets.TEST_RECEIVER_PASSWORD }} | |
publish_github_release: | |
name: Publish to Github | |
needs: | |
- wf_vars | |
- build_router | |
- build_frontend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out changes | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
with: | |
fetch-depth: 0 | |
- name: Download router artifact | |
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }} | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
with: | |
name: prime-router-build-${{ needs.wf_vars.outputs.version }} | |
path: archives/ | |
- name: Download frontend artifact | |
if: ${{ needs.wf_vars.outputs.enable_builds == 'true' }} | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
with: | |
name: static-website-react-${{ needs.wf_vars.outputs.version }} | |
path: archives/ | |
- name: Delete older pre-release | |
if: | | |
${{ needs.wf_vars.outputs.env_name == 'staging' }} || | |
${{ needs.wf_vars.outputs.env_name == 'prod' }} | |
uses: dev-drprasad/delete-older-releases@dfbe6be2a006e9475dfcbe5b8d201f1824c2a9fe | |
with: | |
keep_latest: 0 | |
delete_tags: true | |
delete_tag_pattern: 'pre-release' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ needs.wf_vars.outputs.version }} | |
allowUpdates: true | |
artifacts: "archives/*.tar.gz,LICENSE" | |
prerelease: ${{ needs.wf_vars.outputs.prerelease }} | |
- name: Build changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@32e3c96f29a6532607f638797455e9e98cfc703d | |
with: | |
configuration: '.github/changelog_config.json' | |
# Allow changelog tests in forks | |
owner: 'CDCgov' | |
repo: 'prime-reportstream' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update release notes | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ needs.wf_vars.outputs.version }} | |
allowUpdates: true | |
body: ${{steps.build_changelog.outputs.changelog}} | |
prerelease: ${{ needs.wf_vars.outputs.prerelease }} | |
- name: Delete older releases | |
if: ${{ needs.wf_vars.outputs.env_name == 'prod' }} | |
uses: dev-drprasad/delete-older-releases@dfbe6be2a006e9475dfcbe5b8d201f1824c2a9fe | |
with: | |
keep_latest: 24 | |
delete_tags: false | |
delete_tag_pattern: 'v-20' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |