Skip to content

Commit

Permalink
Merge pull request #13 from unacast/add_log_url
Browse files Browse the repository at this point in the history
Add log_url when creating deployment status
  • Loading branch information
judoole authored Sep 1, 2020
2 parents cfa1b78 + a0327e9 commit d6be60b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 47 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,3 @@ jobs:
args: bin/deployment-create-status bin/deployment-get-id
- name: Docker build
run: docker build -t actions-github-deployment-status .

gh-tagged-release:
name: Tagged release
needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Check Tag
id: check-tag
run: |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo ::set-output name=match::true
fi
- name: Create Release
uses: "marvinpinto/[email protected]"
if: steps.check-tag.outputs.match == 'true'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
15 changes: 0 additions & 15 deletions .github/workflows/versioning.yml

This file was deleted.

12 changes: 3 additions & 9 deletions bin/deployment-create-status
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,19 @@ set -e

BASEDIR=$(dirname "$0")
DEPLOYMENT_ID=$("${BASEDIR}"/deployment-get-id)
GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

DEPLOY_STATE=$(echo "${1}"|tr "[:upper:]" "[:lower:]")
DEPLOY_DESC="${2}"

if [ "$DEPLOY_STATE" = "cancelled" ]; then
DEPLOY_STATE="inactive"
ACCEPT_HEADER="application/vnd.github.ant-man-preview+json"
else
ACCEPT_HEADER="application/vnd.github.flash-preview+json"
fi

ACCEPT_HEADER="application/vnd.github.flash-preview+json"
ACCEPT_HEADER="application/vnd.github.ant-man-preview+json,application/vnd.github.flash-preview+json"


[ -n "${DEPLOY_DESC}" ] || DEPLOY_DESC="Deploying from GitHub Actions"

echo "Setting status to ${DEPLOY_STATE} for deployment-id '${DEPLOYMENT_ID}'"
wget -O-- \
--post-data "{\"state\":\"${DEPLOY_STATE}\", \"target_url\":\"https://github.com/${GITHUB_REPOSITORY}/actions\", \"description\":\"${DEPLOY_DESC}\"}" \
--post-data "{\"state\":\"${DEPLOY_STATE}\", \"target_url\":\"https://github.com/${GITHUB_REPOSITORY}/actions\", \"description\":\"${DEPLOY_DESC}\", \"log_url\":\"${GITHUB_WORKFLOW_URL}\"}" \
--header "Authorization: token ${INPUT_GITHUB_TOKEN}" \
--header "Content-Type: text/json; charset=utf-8" \
--header "Accept: ${ACCEPT_HEADER}" \
Expand Down

0 comments on commit d6be60b

Please sign in to comment.