Merge pull request #36 from gravitational/release/v0.0.11 #35
Workflow file for this run
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
name: CD | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+**" | |
concurrency: | |
group: "Only run one instance of CD for ${{ github.ref_name }}" | |
jobs: | |
cut-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Required to create a release | |
packages: write # Required to push container images | |
steps: | |
- name: Validate the release tag | |
env: | |
# This is copy/pasted from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string | |
SEMVER_TAG_REGEX: ^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ | |
GIT_TAG: ${{ github.ref_name }} | |
run: | | |
# Check if the extracted version is a valid semver | |
if ! $(echo "$GIT_TAG" | grep --perl-regexp --quiet "$SEMVER_TAG_REGEX"); then | |
echo "Extracted version $GIT_TAG is not a valid semver" >&2 | |
exit 1 | |
fi | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Install Earthly | |
uses: earthly/actions-setup@be3fe0c1f84e9776b5a184d21bf7a4a779ea2e6b # v1.0.8 | |
with: | |
# renovate: earthly-version | |
version: v0.8.4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cut a new release for ${{ github.ref_name }} | |
env: | |
GIT_TAG: ${{ github.ref_name }} | |
GH_TOKEN: ${{ github.token }} | |
run: earthly --ci --push --secret GH_TOKEN +release --GIT_TAG="$GIT_TAG" |