Skip to content

Commit

Permalink
Tag latest image (#143)
Browse files Browse the repository at this point in the history
* Tag latest image

* Run prettier
  • Loading branch information
jggoebel authored Jan 13, 2023
1 parent 46cc6c9 commit 8901d3f
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,46 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@master
- name: Checkout
uses: actions/checkout@master

- name: Setup node_modules cache
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# cache node_modules to improve performance dramatically
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Setup node_modules cache
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# cache node_modules to improve performance dramatically
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

- name: Install deps
run: npm install
- name: Install deps
run: npm install

- name: Build
run: npm run build:prod
- name: Build
run: npm run build:prod

- name: Build
run: |
docker build -f cicd/Dockerfile -t $app_image:${GIT_COMMIT_SHORT_HASH:-dev} .
- name: Build
run: |
docker build -f cicd/Dockerfile -t $app_image:${GIT_COMMIT_SHORT_HASH:-dev} .
- name: Docker Login
if: fromJSON(env.should_push_image)
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" \
| docker login -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Docker Login
if: fromJSON(env.should_push_image)
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" \
| docker login -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Docker Push
if: fromJSON(env.should_push_image)
run: |
safe_ref=$(echo "${{ github.ref_name }}" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
publish_tag=$app_image:$safe_ref
docker tag $app_image:${GIT_COMMIT_SHORT_HASH:-dev} $publish_tag
docker push $publish_tag
- name: Docker Push
if: fromJSON(env.should_push_image)
run: |
safe_ref=$(echo "${{ github.ref_name }}" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
publish_tag=$app_image:$safe_ref
- name: Docker Push Latest
if: fromJSON(env.should_tag_latest)
run: docker push $app_image:latest
docker tag $app_image:${GIT_COMMIT_SHORT_HASH:-dev} $publish_tag
docker push $publish_tag
- name: Docker Push Latest
if: fromJSON(env.should_tag_latest)
run: |
docker tag $app_image:${GIT_COMMIT_SHORT_HASH:-dev} $app_image:latest
docker push $app_image:latest

0 comments on commit 8901d3f

Please sign in to comment.