Skip to content

Commit

Permalink
update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhasmitaSw committed May 30, 2024
1 parent 25861f2 commit 8c878ee
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,25 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Convert repository owner lowercase
id: repo_owner
- name: Convert repository owner and repository name to lowercase
id: repo_info
run: |
echo "repo_owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "repo_name=$(echo ${{ github.repository }} | tr '[:upper:] '[:lower:]')" >> $GITHUB_ENV
echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ env.repo_owner }}/${{ env.repo_name }}/test-image:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
secrets: |
GIT_AUTH_TOKEN=${{ secrets.GH_TOKEN }}
tags: ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest

- name: Move Docker cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Log out from GitHub Container Registry
run: docker logout ghcr.io

0 comments on commit 8c878ee

Please sign in to comment.