update workflows

This commit is contained in:
flameshikari
2024-09-06 13:06:40 +05:00
parent 3c80879e5e
commit d3af59b4e0
2 changed files with 15 additions and 50 deletions
+15 -17
View File
@@ -4,18 +4,14 @@ on:
push:
branches:
- master
- dev
paths:
- .github
- .github/workflows/*
- shared
- src
- Dockerfile
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build
@@ -29,21 +25,23 @@ jobs:
with:
submodules: recursive
- name: Export variable
- name: Extract Version
run: |
echo "VERSION=$(cat src/package.json | jq -r '.version')" >> $GITHUB_ENV
echo "VERSION=$(jq -r '.version' src/package.json)" | tee -a $GITHUB_ENV
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to the GitHub Container Registry
- if: ${{ github.ref == 'refs/heads/master' }}
name: Login to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
- if: ${{ github.ref == 'refs/heads/master' }}
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
@@ -54,8 +52,8 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=raw,value=${{ env.VERSION }}
@@ -65,13 +63,13 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
push: ${{ github.ref == 'refs/heads/master' }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags:
${{ steps.meta.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}
- name: Create Release
- if: ${{ github.ref == 'refs/heads/master' }}
name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.VERSION }}
-33
View File
@@ -1,33 +0,0 @@
name: Dry Build
on:
push:
branches:
- dev
paths:
- .github
- shared
- src
- Dockerfile
jobs:
build:
name: Dry Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
cache-from: type=gha
cache-to: type=gha,mode=max