Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions actions/check-sentry-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#*******************************************************************************
#
# check-sentry-action: github action to check whether a sentry corresponding
# to the current commit has been set up in this repo.
# The sentry is a build artifact created by the
# set-sentry-action and is identified by the commit SHA.
#
# Outputs: release_not_built which is true if sentry not found, false otherwise
#
#
# 2022-02-02 Frank Halasz
#
#
# Copyright: 2022 by Interlisp.org
#
#
# *****************************************************************************/
name: 'Check build sentry'
description: 'Check for the sentry that indicates that a build with the current commit has already been completed'
inputs:
tag:
description: "tag that can distinguish this sentry from other sentries in same workflow"
required: false
default: "untagged"
outputs:
release_not_built:
description: "Set to 'true' is a release with this commit has not been built"
value: ${{ steps.sentry.outputs.release_not_built }}
runs:
using: "composite"
steps:
- id: sentry
run: |
set +e
REPO="${{ github.repository }}"
REPO="${REPO#*/}"
curl -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository_owner }}/${REPO}/actions/artifacts \
2>/dev/null \
| grep '"name":' | grep -q "sentry-${{ inputs.tag }}-${{ github.sha }}"
if [ $? -eq 0 ];
then echo ::set-output name=release_not_built::false;
else echo ::set-output name=release_not_built::true;
fi
shell: bash
45 changes: 45 additions & 0 deletions actions/release-tag-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#*******************************************************************************
#
# release-tag-action:
# github action to cretae a release tag for a repo based on the current commit.
# Tag is of the form: <repo-name>-<commit date>-<commit sha first 8>
# Example: medley-220207-ab3412ff
#
# Outputs:
# release_tag: the tag as described
# repo_name: the name of the current github repo (for use in rest of workflow
# since for some off reason the github context does not include
# this bit of info)
#
#
# 2022-02-02 Frank Halasz
#
#
# Copyright: 2022 by Interlisp.org
#
#
# *****************************************************************************/
name: 'Set release tag'
description: 'Compute tag for this release set environment variables accordingly'
outputs:
release_tag:
description: 'Tag to be used for this release based on latest commit date and shortref'
value: ${{ steps.only.outputs.release_tag }}
repo_name:
description: 'Name of the github repo, i.e., "maiko" in repo "Interlisp/maiko"'
value: ${{ steps.only.outputs.repo_name }}
runs:
using: "composite"
steps:
- id: only
run: |
REPO_NAME=${GITHUB_REPOSITORY#*/}
COMMIT_SHORTREF=${GITHUB_SHA::8}
COMMIT_DATE=$(git show -s --date=format:'%y%m%d' --format=%cd ${GITHUB_SHA})
RELEASE_TAG=${REPO_NAME}-${COMMIT_DATE}-${COMMIT_SHORTREF}
#
echo "RELEASE_TAG=${RELEASE_TAG}" >> ${GITHUB_ENV}
echo ::set-output name=release_tag::${RELEASE_TAG}
echo "REPO_NAME=${REPO_NAME}" >> ${GITHUB_ENV}
echo ::set-output name=repo_name::${REPO_NAME}
shell: bash
30 changes: 30 additions & 0 deletions actions/set-sentry-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#*******************************************************************************
#
# set-sentry-action: github action to set a sentry that indicates a build
# based on the current commit has been completed
# successfully. Sentry is a file with commit SHA
# uploaded as an artifact in the current repo.
#
# No outputs.
#
# 2022-02-02 Frank Halasz
#
#
# Copyright: 2022 by Interlisp.org
#
#
# *****************************************************************************/
name: 'Set build sentry'
description: 'Set the sentry that indicates that a build with the current commit has already been completed'
runs:
using: "composite"
steps:
- id: file
run: echo ::set-output name=file::"$(cd ${{ github.workspace }} && cd .. && pwd)/sentry"
shell: bash
- run: echo ${{ github.sha }} > ${{ steps.file.outputs.file }}
shell: bash
- uses: actions/upload-artifact@v2
with:
name: sentry-${{ github.sha }}
path: ${{ steps.file.outputs.file }}