Skip to content

Commit

Permalink
Invert workflow symlink relations due to apparent GHA constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
fheinecke committed Jan 16, 2024
1 parent 1259ecf commit a3ad6d3
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 84 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ami-cleanup-cd.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/ami-cleanup-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: AMI cleanup tool CD
on:
push:
tags:
- "ami-cleanup-v[0-9]+.[0-9]+.[0-9]+**"

concurrency:
group: "Only run one instance of AMI cleanup CD for ${{ github.ref_name }}"

jobs:
cut-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/[email protected]
- name: Install Earthly
uses: earthly/[email protected]
with:
# renovate: earthly-version
version: v0.7.23
- name: Determine actual release semver
env:
# This is copy/pasted from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
SEMVER_TAG_REGEX: ^(?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: |
# Remove the tool name from the front of the tag
SEMVER_TAG=$(echo "$GIT_TAG" | sed 's/^ami-cleanup-v//')
echo "Extracted $SEMVER_TAG from git tag"
# Check if the extracted version is a valid semver
if ! $(echo "$SEMVER_TAG" | grep --perl-regexp --quiet "$SEMVER_TAG_REGEX"); then
echo "Extracted version $SEMVER_TAG is not a valid semver" >&2
exit 1
fi
echo "SEMVER_TAG=$SEMVER_TAG" >> $GITHUB_OUTPUT
- name: Cut a new release for ${{ env.SEMVER_TAG }}
env:
GIT_TAG: ${{ github.ref_name }}
run: earthly -ci +release --GIT_TAG="$SEMVER_TAG"
1 change: 0 additions & 1 deletion .github/workflows/ami-cleanup-ci.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/ami-cleanup-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: AMI cleanup tool CI
on:
pull_request:
branches:
- main

concurrency:
cancel-in-progress: true
group: "Only run one instance of AMI cleanup CI for PR #${{ github.event.number }}"

jobs:
check-if-should-run:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
should-verify-pr: ${{ steps.filter.outputs.changed }} # True if the AMI cleanup tool changed, false otherwise
steps:
- name: Filter out unrelated changes
uses: dorny/[email protected]
id: filter
with:
filters: |
changed: "tools/ami-cleanup/**"
verify-pr:
runs-on: ubuntu-latest
needs:
- check-if-should-run
if: ${{ needs.check-if-should-run.outputs.should-verify-pr }}
steps:
- name: Checkout repo
uses: actions/[email protected]
- name: Install Earthly
uses: earthly/[email protected]
with:
# renovate: earthly-version
version: v0.7.23
- name: Lint Go code
run: earthly -ci +lint --OUTPUT_FORMAT=github-actions
- name: Run Go tests
run: earthly -ci +test --OUTPUT_FORMAT=github-actions
41 changes: 0 additions & 41 deletions tools/ami-cleanup/workflows/cd.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tools/ami-cleanup/workflows/cd.yaml
41 changes: 0 additions & 41 deletions tools/ami-cleanup/workflows/ci.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tools/ami-cleanup/workflows/ci.yaml

0 comments on commit a3ad6d3

Please sign in to comment.