diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-03-06 00:01:05 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-05 18:31:05 +0000 |
commit | 47aecbca538d1109b37853eb4912cfe80b7804df (patch) | |
tree | 88ac663027a767af7cd66cf7681019009ad07586 | |
parent | 208e49e4d51891f2a3d16647ceb43eef9eebfce6 (diff) |
Follow-up fixes to snapshot deployment (#1768)
* scripts/deploy-snapshot: ensure GITHUB_WORKSPACE is set when script is run
* scripts/deploy-snapshot: prevent command output from breaking comparison
* scripts/deploy-snapshot: fix shellcheck nits
* gitignore: add outputs directory
* github: pass privileged token to deployment script
-rw-r--r-- | .github/workflows/deploy_snapshot.yml | 2 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rwxr-xr-x | scripts/deploy-snapshot.sh | 12 |
3 files changed, 11 insertions, 6 deletions
diff --git a/.github/workflows/deploy_snapshot.yml b/.github/workflows/deploy_snapshot.yml index e8f41046..ecb4ea36 100644 --- a/.github/workflows/deploy_snapshot.yml +++ b/.github/workflows/deploy_snapshot.yml @@ -42,3 +42,5 @@ jobs: - name: Deploy snapshot run: scripts/deploy-snapshot.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -153,3 +153,6 @@ fabric.properties !/gradle/wrapper/gradle-wrapper.jar # End of https://www.gitignore.io/api/androidstudio,gradle + +# Default output directory for APK and Bundle collection tasks +app/outputs diff --git a/scripts/deploy-snapshot.sh b/scripts/deploy-snapshot.sh index 5a8c846f..760e52ef 100755 --- a/scripts/deploy-snapshot.sh +++ b/scripts/deploy-snapshot.sh @@ -8,7 +8,7 @@ set -ex LATEST_TAG="latest" CURRENT_REV="$(git rev-parse --short HEAD)" -ASSET_DIRECTORY="${GITHUB_WORKSPACE}/app/outputs" +ASSET_DIRECTORY="${GITHUB_WORKSPACE:?}/app/outputs" function overwrite_local_tag() { git tag -f "${LATEST_TAG}" @@ -19,7 +19,7 @@ function overwrite_remote_tag() { } function has_release() { - gh release view "${LATEST_TAG}" + gh release view "${LATEST_TAG}" &>/dev/null echo "$?" } @@ -28,18 +28,18 @@ function delete_release() { } function create_rev_file() { - pushd "${ASSET_DIRECTORY}" + pushd "${ASSET_DIRECTORY}" || return echo "${CURRENT_REV}" | tee rev-hash.txt - popd + popd || return } function create_release() { local CHANGELOG_FILE CHANGELOG_FILE="$(mktemp)" echo "Latest release for APS from revision ${CURRENT_REV}" | tee "${CHANGELOG_FILE}" - pushd "${ASSET_DIRECTORY}" + pushd "${ASSET_DIRECTORY}" || return gh release create --title "Latest snapshot build" -F "${CHANGELOG_FILE}" "${LATEST_TAG}" ./* - popd + popd || return } overwrite_local_tag |