Skip to content

Commit

Permalink
refactor: fully rename git lookup hash to sha (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdassonvil authored Jun 3, 2024
1 parent b019903 commit d0c8271
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ecs-deploy-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ jobs:
- name: Get former version from Git
id: git_hash
id: git_sha
if: "!inputs.use_version_as_docker_image_tag"
uses: sencrop/github-workflows/actions/lookup-git-hash@master
uses: sencrop/github-workflows/actions/lookup-git-sha@master

- name: Notify deployment in progress
uses: sencrop/github-workflows/actions/notify-deployment-in-progress@master
with:
service: ${{ inputs.service }}
environment: ${{ inputs.environment }}
dd_api_key: ${{ secrets.DD_API_KEY }}
former_version: ${{ steps.ecs_lookup.outputs.image_tag || steps.git_hash.outputs.previous }}
former_version: ${{ steps.ecs_lookup.outputs.image_tag || steps.git_sha.outputs.previous }}
new_version: ${{ inputs.version }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}

Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/version-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.git_hash.outputs.REF || steps.git_tags.outputs.REF }}
previous_version: ${{ steps.git_hash.outputs.PREVIOUS_REF || steps.git_tags.outputs.PREVIOUS_REF }}
version: ${{ steps.git_sha.outputs.REF || steps.git_tag.outputs.REF }}
previous_version: ${{ steps.git_sha.outputs.PREVIOUS_REF || steps.git_tag.outputs.PREVIOUS_REF }}
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -31,19 +31,11 @@ jobs:
[[ "${{ inputs.from }}" == "sha" ]] || [[ "${{ inputs.from }}" = "tag" ]]
- name: Get version from git sha
id: git_sha
if: inputs.from == 'sha'
id: git_hash
run: |
REF="$(git rev-parse --short HEAD)"
PREVIOUS_REF="$(git rev-parse --short HEAD~1)"
echo "REF=$REF" >> "${GITHUB_OUTPUT}"
echo "PREVIOUS_REF=$PREVIOUS_REF" >> "${GITHUB_OUTPUT}"
uses: sencrop/github-workflows/actions/lookup-git-sha@master

- name: Get version from git tag
id: git_tag
if: inputs.from == 'tag'
id: git_tags
run: |
REF="${GITHUB_REF#refs/tags/}"
PREVIOUS_REF="$(git tag -l 'v*' --sort=-v:refname | head -n2 | tail -n1)"
echo "REF=$REF" >> "${GITHUB_OUTPUT}"
echo "PREVIOUS_REF=$PREVIOUS_REF" >> "${GITHUB_OUTPUT}"
uses: sencrop/github-workflows/actions/lookup-git-tag@master
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: "Lookup git hash"
name: "Lookup git sha"

runs:
using: "composite"
steps:
- name: Lookup current and previous Git hash
id: git_hash
- name: Lookup current and previous Git sha
id: git_sha
run: |
REF="$(git rev-parse --short HEAD)"
PREVIOUS_REF="$(git rev-parse --short HEAD~1)"
Expand Down

0 comments on commit d0c8271

Please sign in to comment.