Skip to content

Commit

Permalink
Merge pull request #135 from GiganticMinecraft/fix/short-sha-ci
Browse files Browse the repository at this point in the history
Use internal action to get commit SHA
  • Loading branch information
Lucky3028 authored Sep 12, 2024
2 parents ed3b8f3 + 94a3f8a commit 6a012c8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .github/actions/short-sha/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: output-sha
description: Outputs Short commit SHA.
outputs:
SHA:
value: ${{ steps.sha.outputs.sha }}
description: commit SHA value.
runs:
using: composite
steps:
- uses: actions/checkout@v4
- name: Output commit SHA
shell: bash
id: sha
run: |
SHA=$(git show --format='%h' --no-patch)
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
echo "$SHA"
3 changes: 3 additions & 0 deletions .github/pinact.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files:
- pattern: '^(.*/)*action\\.yaml$'
- pattern: '^\.github/workflows/.*\\.yaml$'
4 changes: 2 additions & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Output SHA
uses: benjlevesque/short-sha@599815c8ee942a9616c92bcfb4f947a3b670ab0b # v3.0.0
uses: ./.github/actions/short-sha
id: short-sha
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
Expand All @@ -32,7 +32,7 @@ jobs:
echo "value=$TAG_NAME" >> "$GITHUB_OUTPUT"
echo "$TAG_NAME"
env:
SHA: ${{ steps.short-sha.outputs.sha }}
SHA: ${{ steps.short-sha.outputs.SHA }}
- name: Create release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Output SHA
uses: benjlevesque/short-sha@599815c8ee942a9616c92bcfb4f947a3b670ab0b # v3.0.0
uses: ./.github/actions/short-sha
id: short-sha
- name: Set plugin ver with SHA commit
run: |
sed -ri "s/^(versionSuffix=).*/\1sha-${SHA}/" gradle.properties || :
env:
SHA: ${{ steps.short-sha.outputs.sha }}
SHA: ${{ steps.short-sha.outputs.SHA }}
- name: Set up JDK
uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Lint GitHub Actions
on:
push:
paths:
- .github/workflows/**
- .github/**
permissions: {}
jobs:
pinact:
Expand Down Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Run ghalint
run: |
ghalint -c ./.github/ghalint.yaml run
- name: Run ghalint for actions
run: |
ghalint run-action
actionlint:
runs-on: ubuntu-22.04
timeout-minutes: 2
Expand Down

0 comments on commit 6a012c8

Please sign in to comment.