Refactored build
This commit is contained in:
parent
f731beab23
commit
9c5a340b14
@ -1,56 +0,0 @@
|
||||
name: SharePulse docker image build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-docker-image:
|
||||
needs: build-jar
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Extract tag name
|
||||
id: get_tag
|
||||
run: |
|
||||
TAG_NAME=$(echo $GITEA_REF | sed -n 's/refs\/tags\/v\([0-9.]*\)/\1/p')
|
||||
if [ -z "$TAG_NAME" ]; then
|
||||
echo "Tag does not start with 'v', skipping..."
|
||||
exit 78 # Exiting with specific status to mark job as skipped
|
||||
fi
|
||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Initialize Docker runtime
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install ca-certificates curl gnupg lsb-release -y
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -y
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: jar-artifact
|
||||
path: build/libs
|
||||
|
||||
- name: Build Docker Image
|
||||
run: docker build . -t walzen665/sharepulse:latest
|
||||
|
||||
- name: Tag Docker image
|
||||
run: docker tag walzen665/sharepulse:latest git.walzen665.de/walzen665/sharepulse:latest
|
||||
|
||||
- name: Log in to Gitea Docker Registry
|
||||
run: echo ${{ secrets.GITEAREGISTRYTOKEN }} | docker login -u ${{ secrets.GITEAREGISTRYUSERNAME }} --password-stdin https://git.walzen665.de
|
||||
|
||||
- name: Push Docker Image to Gitea
|
||||
run: docker push git.walzen665.de/walzen665/sharepulse:latest
|
@ -41,4 +41,55 @@ jobs:
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: jar-artifact
|
||||
path: build/libs/*.jar
|
||||
path: build/libs/*.jar
|
||||
|
||||
build-docker-image:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build-jar
|
||||
steps:
|
||||
- name: Extract tag name
|
||||
id: get_tag
|
||||
run: |
|
||||
TAG_NAME=$(echo $GITEA_REF | sed -n 's/refs\/tags\/v\([0-9.]*\)/\1/p')
|
||||
if [ -z "$TAG_NAME" ]; then
|
||||
echo "Tag does not start with 'v', skipping..."
|
||||
exit 78 # Exiting with specific status to mark job as skipped
|
||||
fi
|
||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Initialize Docker runtime
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install ca-certificates curl gnupg lsb-release -y
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -y
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: jar-artifact
|
||||
path: build/libs
|
||||
|
||||
- name: Build Docker Image
|
||||
run: docker build . -t walzen665/sharepulse:latest
|
||||
|
||||
- name: Tag Docker image
|
||||
run: docker tag walzen665/sharepulse:latest git.walzen665.de/walzen665/sharepulse:latest
|
||||
|
||||
- name: Log in to Gitea Docker Registry
|
||||
run: echo ${{ secrets.GITEAREGISTRYTOKEN }} | docker login -u ${{ secrets.GITEAREGISTRYUSERNAME }} --password-stdin https://git.walzen665.de
|
||||
|
||||
- name: Push Docker Image to Gitea
|
||||
run: docker push git.walzen665.de/walzen665/sharepulse:latest
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user