Skip to content

Release - Nightly

Release - Nightly #304

name: Release - Nightly
on:
workflow_dispatch:
# At 03:00 (UTC) daily
# https://crontab.guru/#0_3_*_*_*
# This is a good time for nightly builds, across CET, PST and IST (QA team in India)
schedule:
- cron: '0 3 * * *'
jobs:
check-date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should-run: ${{ steps.should-run.outputs.should-run }}
latest-commit-hash: ${{ steps.latest-commit-hash.outputs.latest-commit-hash }}
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- id: latest-commit-hash
name: Print latest commit
run: echo $(git rev-parse HEAD) && echo "latest-commit-hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- id: should-run
continue-on-error: true
name: Check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" $(git rev-parse HEAD)) && echo "should-run=false" >> $GITHUB_OUTPUT
trigger-expo-eas-nightly:
runs-on: ubuntu-latest
needs: check-date
if: ${{ needs.check-date.outputs.should-run != 'false' }}
name: Trigger Expo EAS nightly build
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Fetch all history for all tags and branches
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
project_id: celo-mobile-mainnet
credentials_json: ${{ secrets.GCP_MAINNET_RELEASE_AUTOMATION_SERVICE_ACCOUNT_KEY }}
- name: Google Secrets
id: google-secrets
uses: google-github-actions/get-secretmanager-secrets@bc9c54b29fdffb8a47776820a7d26e77b379d262 # v3.0.0
with:
secrets: |-
SLACK_WEBHOOK_URL:projects/1027349420744/secrets/SLACK_WEBHOOK_URL
BOT_SSH_KEY:projects/1027349420744/secrets/BOT_SSH_PRIVATE_KEY
- uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1
with:
ssh-private-key: ${{ steps.google-secrets.outputs.BOT_SSH_KEY }}
- uses: ./.github/actions/yarn-install
- name: Generate release notes
run: |
RELEASE_NOTES=$(yarn --silent ts-node scripts/generate-release-notes.ts --lastTag tags/nightly --toRef ${{ needs.check-date.outputs.latest-commit-hash }} --verbose false)
echo -e "RELEASE_NOTES<<EOF\n$RELEASE_NOTES\nEOF" >> $GITHUB_ENV
# This will trigger the EAS build
- name: Update nightly tag
run: |
git tag -f nightly "${{ needs.check-date.outputs.latest-commit-hash }}"
git push origin --force tags/nightly
- name: Build notification
uses: edge/simple-slack-notify@d841831738af1d83ecc27186e722322145c21488 # v1.1.2
with:
status: success
success_text: '🚀 Nightly EAS build has been triggered and should be available shortly! 🥳'
# the RELEASE_NOTES are generated in the previous step
fields: |
[
{
"title": "Changes included",
"value": ${JSON.stringify(env.RELEASE_NOTES)}
}
]
env:
SLACK_WEBHOOK_URL: ${{ steps.google-secrets.outputs.SLACK_WEBHOOK_URL }}