Merge pull request #3369 from dfinity/fix-file-name #3453
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
# Continuous Deployment job to deploy the portal to the Internet Computer as an asset canister | |
# as well as to the Netlify internetcomputer.org | |
name: CD | |
on: | |
push: | |
branches: [master] | |
repository_dispatch: | |
types: redeploy | |
jobs: | |
deploy-ic: | |
name: "Deploy to IC" | |
runs-on: ubuntu-latest | |
concurrency: | |
group: "website update" | |
cancel-in-progress: true | |
environment: | |
name: "Internet Computer Mainnet" | |
url: ${{ fromJson(steps.get-url.outputs.url) }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- run: git submodule update --init | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install DFX | |
uses: dfinity/setup-dfx@main | |
- name: Dump Identity | |
run: | | |
mkdir -p ~/.config/dfx/identity/default | |
echo $DFX_IDENTITY_DESIGN_TEAM | base64 -d > ~/.config/dfx/identity/default/identity.pem | |
sed -i 's/\\r\\n/\r\n/g' ~/.config/dfx/identity/default/identity.pem | |
env: | |
DFX_IDENTITY_DESIGN_TEAM: ${{ secrets.DFX_IDENTITY_DESIGN_TEAM }} | |
- name: Check Canister Balance | |
run: | | |
balance=$(dfx canister --network ic status portal 2>&1 >/dev/null | grep Balance: | sed 's/[^0-9]//g') | |
LANG=en_US.UTF-8 | |
balance_formatted=$(echo $balance | awk '{printf "%'\''d\n", $0}') | |
echo "Canister balance: $balance_formatted" | |
if [ "5000000000000" -gt "$balance" ]; then | |
canister_id=$(cat "$GITHUB_WORKSPACE/canister_ids.json" | jq -r '.portal.ic') | |
template="{ \"channel\": \"C04EGHHU9U2\", \"blocks\": [ { \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"@channel internetcomputer.org canister \`$canister_id\` balance is \`$balance_formatted\`.\n\nTop it up by\n- running \`dfx ledger --network ic top-up $canister_id --amount 5.0\`\n- or by adding the canister on the NNS and sending cycles to it.\" } } ]}" | |
curl --data "$template" -H "Content-type: application/json" -H "Authorization: Bearer $SLACK_TOKEN" -X POST https://slack.com/api/chat.postMessage -o /dev/null | |
fi | |
env: | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
- name: Install Dependencies | |
run: npm install | |
- name: Deploy to Mainnet | |
run: dfx deploy --network=ic --no-wallet portal | |
env: | |
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }} | |
CONTENTFUL_HOST: ${{ secrets.CONTENTFUL_HOST }} | |
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }} | |
AIRTABLE_KEY: ${{ secrets.AIRTABLE_SA_PORTAL_SERVICE_ACCOUNT }} | |
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
- name: Get URL | |
id: get-url | |
run: | | |
URL="https://$(cat "$GITHUB_WORKSPACE/canister_ids.json" | jq -r '.portal.ic').raw.ic0.app" | |
echo "::set-output name=url::\"$URL\"" |