Skip to content

Instantly share code, notes, and snippets.

@trilliwon
Created February 6, 2025 05:02
Show Gist options
  • Select an option

  • Save trilliwon/316d2d16624f67fa539e28435c48e566 to your computer and use it in GitHub Desktop.

Select an option

Save trilliwon/316d2d16624f67fa539e28435c48e566 to your computer and use it in GitHub Desktop.
Deploy AppStore github action sample
name: Deploy to AppStore
on:
workflow_dispatch:
inputs:
slack_channel:
description: "Slack Channel"
required: false
default: "group_ios_notifications"
type: string
slack_thread_ts:
description: "Slack Thread TS"
required: false
default: null
type: string
release_notes:
description: "Release Notes"
required: false
default: null
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: [self-hosted, m5-mac-pro]
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
APPSTORE_CONNECT_KEY_CONTENT: ${{ secrets.APPSTORE_CONNECT_KEY_CONTENT }}
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: checkout submodule
run: |
git submodule init
git submodule update
- name: bundle install
run: bundle install
- name: getstarted.sh
run: ./getstarted.sh
- name: Print the all inputs to STDOUT
run: echo inputs are ${{ inputs }}
- name: Dump Github context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Notify Slack that deployment has started
id: slack
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: "${{ inputs.slack_channel }}"
payload: |
{
"text": "🚀",
"thread_ts": "${{ inputs.slack_thread_ts }}",
"attachments": [
{
"color": "28a745",
"fields": [
{
"title": "Status",
"short": true,
"value": "AppStore deployment has started!"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
- name: Run Fastlane
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: bundle exec fastlane release --verbose slack_channel:${{ inputs.slack_channel }} slack_thread_ts:${{ inputs.slack_thread_ts }}
- name: Notify Slack on failure
id: slack-failure
uses: slackapi/slack-github-action@v1.25.0
if: ${{ failure() }}
with:
channel-id: "${{ inputs.slack_channel }}"
payload: |
{
"text": "Failure",
"thread_ts": "${{ inputs.slack_thread_ts }}",
"blocks": [
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":link: Failed Action"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
- name: Notify Slack on success
id: slack-success
uses: slackapi/slack-github-action@v1.25.0
if: ${{ success() }}
with:
channel-id: "${{ inputs.slack_channel }}"
payload: |
{
"thread_ts": "${{ inputs.slack_thread_ts }}",
"blocks": [
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":link: Success Action"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment