This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
name: Build and Publish
|
name: Build and Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- "**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -14,17 +12,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Login al registry di Gitea
|
- name: Login al registry di Gitea
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.AUTHTOKEN }}" | docker login ${{ vars.REGISTRY_URL }} -u ${{ github.repository_owner }} --password-stdin
|
echo "${{ secrets.AUTHTOKEN }}" | docker login ${{ vars.REGISTRY_URL }} -u ${{ github.repository_owner }} --password-stdin
|
||||||
echo "${{ secrets.AUTHTOKEN }}" ${{ vars.REGISTRY_URL }} ${{ github.repository_owner }}
|
|
||||||
|
|
||||||
- name: Extract build artifacts
|
- name: Extract build artifacts
|
||||||
run: |
|
run: |
|
||||||
docker build --target artifacts --output type=local,dest=./out .
|
docker build --target artifacts --output type=local,dest=./out .
|
||||||
tar -czf build-artifact.tar.gz -C out dist/
|
ls -la ./out/
|
||||||
|
tar -czf build-artifact.tar.gz -C ./out/dist .
|
||||||
- name: Build immagine Docker
|
- name: Build immagine Docker
|
||||||
run: |
|
run: |
|
||||||
IMAGE_NAME="${{ vars.REGISTRY_URL }}/${{ github.repository }}"
|
IMAGE_NAME="${{ vars.REGISTRY_URL }}/${{ github.repository }}"
|
||||||
@@ -35,14 +30,12 @@ jobs:
|
|||||||
-t ${IMAGE_NAME}:latest \
|
-t ${IMAGE_NAME}:latest \
|
||||||
.
|
.
|
||||||
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
|
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Push immagine Docker
|
- name: Push immagine Docker
|
||||||
run: |
|
run: |
|
||||||
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||||
docker push ${{ env.IMAGE_NAME }}:${{ github.ref_name }}
|
docker push ${{ env.IMAGE_NAME }}:${{ github.ref_name }}
|
||||||
docker push ${{ env.IMAGE_NAME }}:latest
|
docker push ${{ env.IMAGE_NAME }}:latest
|
||||||
echo "Docker image pushed successfully!"
|
echo "Docker image pushed successfully!"
|
||||||
|
|
||||||
- name: Upload to Gitea Package Registry
|
- name: Upload to Gitea Package Registry
|
||||||
run: |
|
run: |
|
||||||
VERSION="${GITHUB_REF_NAME:-main}"
|
VERSION="${GITHUB_REF_NAME:-main}"
|
||||||
@@ -53,4 +46,3 @@ jobs:
|
|||||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/packages/generic/${REPO_NAME}/${VERSION}/build-artifact.tar.gz"
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/packages/generic/${REPO_NAME}/${VERSION}/build-artifact.tar.gz"
|
||||||
echo "Artifact uploaded to Package Registry!"
|
echo "Artifact uploaded to Package Registry!"
|
||||||
echo "Download at: ${{ github.server_url }}/${{ github.repository }}/-/packages"
|
echo "Download at: ${{ github.server_url }}/${{ github.repository }}/-/packages"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user