Skip to content

Commit

Permalink
Test tags
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-wal committed Sep 3, 2024
1 parent ceebb70 commit 6368745
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/deploy-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@ on:
default: 'latest'

jobs:
check-version:
if: ${{ github.ref_name == 'main' && inputs.version != '' }}
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Bump version
run: |
npm version ${{ inputs.version }} --no-git-tag-version
- name: Commit version change
run: |
git commit -am "Update version to ${{ inputs.version }}"
git push origin main
prepare-matrix:
runs-on: ubuntu-latest
outputs:
Expand All @@ -25,10 +47,10 @@ jobs:
- name: Determine matrix
id: set-matrix
run: |
if [[ "${{ github.ref_name }}" == "workflow" ]]; then
echo "matrix={\"include\":[{\"build-type\":\"production\",\"tag_suffix\":\"prod\",\"environment\":\"production-fidl\"}, {\"build-type\":\"staging\",\"tag_suffix\":\"stg\",\"environment\":\"staging-fidl\"}]}" >> $GITHUB_OUTPUT
if [[ "${{ github.ref_name }}" == "workflows" ]]; then
echo "matrix={\"include\":[{\"build-type\":\"production\",\"tag_suffix\":\"production\",\"environment\":\"production-fidl\"}, {\"build-type\":\"staging\",\"tag_suffix\":\"stg\",\"environment\":\"staging-fidl\"}]}" >> $GITHUB_OUTPUT
else
echo "matrix={\"include\":[{\"build-type\":\"staging\",\"tag_suffix\":\"stg\",\"environment\":\"staging-fidl\"}]}" >> $GITHUB_OUTPUT
echo "matrix={\"include\":[{\"build-type\":\"staging\",\"tag_suffix\":\"staging\",\"environment\":\"staging-fidl\"}]}" >> $GITHUB_OUTPUT
fi
ReuseableMatrixJobForDeployment:
Expand All @@ -38,6 +60,7 @@ jobs:

uses: ./.github/workflows/release-new-version.yml
with:
version: ${{ inputs.version }}
tag_suffix: ${{ matrix.tag_suffix }}
environment: ${{ matrix.environment }}
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/release-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:
latest=false
images: public.ecr.aws/f4h6r4m9/${{ env.ECR_REPOSITORY }}
tags: |
type=semver,pattern={{branch}}-{{version}},value=v${{ inputs.version }},suffix={{ matrix.tag_suffix }},enable=${{inputs.version != ''}}
type=ref,event=branch,pattern={{branch}},suffix={{ matrix.tag_suffix }},enable=${{ github.ref_name == 'workflow' }}
type=semver,pattern={{branch}}-{{version}},value=v${{ inputs.version }},suffix=-{{ matrix.tag_suffix }},enable=${{inputs.version != ''}}
type=ref,event=branch,pattern={{branch}},suffix=-{{ matrix.tag_suffix }},enable=${{ github.ref_name == 'workflow' }}
type=ref,event=pr,pattern={{branch}}
- name: Create env file
Expand Down

0 comments on commit 6368745

Please sign in to comment.