-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
1,398 additions
and
163 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
changelog: | ||
exclude: | ||
authors: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Deployments after PR closure | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
update-deployment: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
deployments: write | ||
|
||
steps: | ||
- name: Update deployment statuses to Inactive | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} | ||
run: | | ||
AUTHORIZATION="Authorization: token $GITHUB_TOKEN" | ||
ACCEPT="Accept: application/vnd.github.ant-man-preview+json" | ||
PR_URL="https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$GITHUB_PR_NUMBER" | ||
DEPLOYMENTS_URL="https://api.github.com/repos/$GITHUB_REPOSITORY/deployments" | ||
echo "Working with PR URL: $PR_URL" | ||
# Get the pull request head branch | ||
HEAD_BRANCH=$(curl -s -H "$AUTHORIZATION" "$PR_URL" | jq -r '.head.ref') | ||
if [ "$HEAD_BRANCH" == "null" ]; then | ||
echo "No PR available, so no founded environments. Exiting..." | ||
exit 0 | ||
fi | ||
# Get the pull request state | ||
PR_STATE=$(curl -s -H "$AUTHORIZATION" "$PR_URL" | jq -r '.state') | ||
if [ "$PR_STATE" != "closed" ]; then | ||
echo "PR not closed. Exiting..." | ||
exit 0 | ||
fi | ||
# Remove "feature/" from the head branch | ||
BUILD_NAME=$(echo "$HEAD_BRANCH" | sed 's/feature\///g') | ||
# Define environment names | ||
IOS_ENVIRONMENT=$(echo "playsrg-ios-nightly+$BUILD_NAME" | jq -R -r @uri) | ||
TVOS_ENVIRONMENT=$(echo "playsrg-tvos-nightly+$BUILD_NAME" | jq -R -r @uri) | ||
echo "Working with iOS environment: $IOS_ENVIRONMENT" | ||
echo "Working with tvOS environment: $TVOS_ENVIRONMENT" | ||
# Get the latest active deployment for iOS | ||
IOS_DEPLOYMENT=$(curl -s -H "$AUTHORIZATION" "$DEPLOYMENTS_URL?environment=$IOS_ENVIRONMENT" | jq '.[0]') | ||
# Get the latest active deployment for tvOS | ||
TVOS_DEPLOYMENT=$(curl -s -H "$AUTHORIZATION" "$DEPLOYMENTS_URL?environment=$TVOS_ENVIRONMENT" | jq '.[0]') | ||
# Function to fetch log and environment URLs from status URL | ||
fetch_status_urls() { | ||
STATUS_URL=$1 | ||
STATUS_RESPONSE=$(curl -s -H "$AUTHORIZATION" "$STATUS_URL") | ||
FIRST_STATUS=$(echo "$STATUS_RESPONSE" | jq -r '.[0]') | ||
LOG_URL=$(echo "$FIRST_STATUS" | jq -r '.log_url') | ||
ENVIRONMENT_URL=$(echo "$FIRST_STATUS" | jq -r '.environment_url') | ||
echo "$LOG_URL,$ENVIRONMENT_URL" | ||
} | ||
if [ "$IOS_DEPLOYMENT" != "null" ]; then | ||
DEPLOYMENT_ID=$(echo "$IOS_DEPLOYMENT" | jq -r '.id') | ||
STATUSES_URL=$(echo "$IOS_DEPLOYMENT" | jq -r '.statuses_url') | ||
echo "Working with iOS deployment ID: $DEPLOYMENT_ID" | ||
URLS=$(fetch_status_urls "$STATUSES_URL") | ||
IFS=',' read -r LOG_URL ENVIRONMENT_URL <<< "$URLS" | ||
# Mark the latest deployment for iOS nightly as inactive | ||
DEPLOYMENT_URL="$DEPLOYMENTS_URL/$DEPLOYMENT_ID/statuses" | ||
BODY="{\"state\": \"inactive\", \"description\": \"The PR is closed.\", \ | ||
\"log_url\": \"$LOG_URL\", \"environment_url\": \"$ENVIRONMENT_URL\"}" | ||
RESPONSE=$(curl -s -X POST -H "$AUTHORIZATION" -H "$ACCEPT" "$DEPLOYMENT_URL" -d "$BODY") | ||
# Extract information from the response | ||
RESPONSE_STATE=$(echo "$RESPONSE" | jq -r '.state') | ||
RESPONSE_ENVIRONMENT=$(echo "$RESPONSE" | jq -r '.environment') | ||
# Output the information | ||
echo "-> Update $RESPONSE_ENVIRONMENT latest deployment to $RESPONSE_STATE state." | ||
else | ||
IOS_ENVIRONMENT=$(printf '%b' "${IOS_ENVIRONMENT//%/\\x}") | ||
echo "-> No deployment for $IOS_ENVIRONMENT environment. No update." | ||
fi | ||
if [ "$TVOS_DEPLOYMENT" != "null" ]; then | ||
DEPLOYMENT_ID=$(echo "$TVOS_DEPLOYMENT" | jq -r '.id') | ||
STATUSES_URL=$(echo "$TVOS_DEPLOYMENT" | jq -r '.statuses_url') | ||
echo "Working with tvOS deployment ID: $DEPLOYMENT_ID" | ||
URLS=$(fetch_status_urls "$STATUSES_URL") | ||
IFS=',' read -r LOG_URL ENVIRONMENT_URL <<< "$URLS" | ||
# Mark the latest deployment for tvOS nightly as inactive | ||
DEPLOYMENT_URL="$DEPLOYMENTS_URL/$DEPLOYMENT_ID/statuses" | ||
BODY="{\"state\": \"inactive\", \"description\": \"The PR is closed.\", \ | ||
\"log_url\": \"$LOG_URL\", \"environment_url\": \"$ENVIRONMENT_URL\"}" | ||
RESPONSE=$(curl -s -X POST -H "$AUTHORIZATION" -H "$ACCEPT" "$DEPLOYMENT_URL" -d "$BODY") | ||
# Extract information from the response | ||
RESPONSE_STATE=$(echo "$RESPONSE" | jq -r '.state') | ||
RESPONSE_ENVIRONMENT=$(echo "$RESPONSE" | jq -r '.environment') | ||
# Output the information | ||
echo "-> Update $RESPONSE_ENVIRONMENT latest deployment to $RESPONSE_STATE state." | ||
else | ||
TVOS_ENVIRONMENT=$(printf '%b' "${TVOS_ENVIRONMENT//%/\\x}") | ||
echo "-> No deployment for $TVOS_ENVIRONMENT environment. No update." | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
deployments: | ||
environmentMapping: | ||
testing: | ||
- "playsrg-ios-nightly*" | ||
- "playsrg-tvos-nightly*" | ||
- "playsrg-ios-beta+*" | ||
- "playsrg-tvos-beta+*" | ||
- "playsrg-ios-testflight+*" | ||
- "playsrg-tvos-testflight+*" | ||
staging: | ||
- "playsrg-ios-beta" | ||
- "playsrg-tvos-beta" | ||
- "playsrg-ios-testflight" | ||
- "playsrg-tvos-testflight" | ||
production: | ||
- "playsrg-ios-appstore*" | ||
- "playsrg-tvos-appstore*" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
inherit_mode: | ||
merge: | ||
- Include | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
included: | ||
- Application | ||
- Common | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rules: | ||
line-length: | ||
max: 120 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSPrivacyAccessedAPITypes</key> | ||
<array> | ||
<dict> | ||
<key>NSPrivacyAccessedAPIType</key> | ||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string> | ||
<key>NSPrivacyAccessedAPITypeReasons</key> | ||
<array> | ||
<string>CA92.1</string> | ||
<string>1C8F.1</string> | ||
</array> | ||
</dict> | ||
<dict> | ||
<key>NSPrivacyAccessedAPIType</key> | ||
<string>NSPrivacyAccessedAPICategoryDiskSpace</string> | ||
<key>NSPrivacyAccessedAPITypeReasons</key> | ||
<array> | ||
<string>85F4.1</string> | ||
<string>E174.1</string> | ||
</array> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
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
Oops, something went wrong.