Compare commits
11 Commits
39ce4f9ee9
...
main
Author | SHA1 | Date | |
---|---|---|---|
41fb28f535 | |||
ec9be23afe | |||
6c4a4b754b | |||
270ad0ee50 | |||
b4072034f5 | |||
93bdddf8ed | |||
ddfdd3a92e | |||
b1257c57ae | |||
afae441d6c | |||
0bed4eb617 | |||
b494a20b50 |
@ -24,40 +24,50 @@ jobs:
|
||||
- name: Build .jar with Maven
|
||||
run: ./mvnw package spring-boot:repackage
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: jar-artifact
|
||||
path: target/*.jar
|
||||
build-image:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- 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
|
||||
sudo apt-get update
|
||||
sudo apt-get install ca-certificates curl
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
# Add the repository to Apt sources:
|
||||
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
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo 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 .jar Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: jar-artifact
|
||||
|
||||
- name: (Optional) List files and path in the repository
|
||||
run: |
|
||||
ls -la
|
||||
pwd
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t walzen665/spring-cicd-test:latest --build-arg="JAR_FILE=target/demo-0.0.1-SNAPSHOT-spring-boot.jar" .
|
||||
run: docker build -t walzen665/spring-cicd-test:latest --build-arg="JAR_FILE=demo-0.0.1-SNAPSHOT-spring-boot.jar" .
|
||||
|
||||
- name: Tag Docker image
|
||||
run: docker tag walzen665/spring-cicd-test:latest git.walzen665.de/walzen665/spring-cicd-test:latest
|
||||
|
||||
- name: Log in to Gitea Docker Registry
|
||||
run: echo ${{ secrets.GITEAREGISTRYTOKEN }} | docker login -u ${{ secrets.GITEAREGISTRYUSERNAME }} --password-stdin https://git.walzen665.de
|
||||
push-image:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
||||
- name: Push Docker Image to Gitea
|
||||
run: docker push git.walzen665.de/walzen665/spring-cicd-test:latest
|
||||
collect-artifacts:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifacts
|
||||
path: target/*.jar
|
||||
run: docker push git.walzen665.de/walzen665/spring-cicd-test:latest
|
@ -3,8 +3,11 @@
|
||||
This is a sample project to demonstrate CI/CD using Gitea and Gitea Runner.
|
||||
|
||||
## Details
|
||||
Run actions build a executable .jar file with the help of maven. It contains the basic Spring Boot WebApp wich serves a simple HTML page with sample text to `localhost:8080/`.
|
||||
The configured Action Pipeline builds a executable .jar file with the help of maven. It contains the basic Spring Boot WebApp wich serves a simple HTML page with sample text to `localhost:8080/`.
|
||||
|
||||
This project uploads configured artifacts. Checkout `.gitea/workflows` for more details.
|
||||
|
||||
The docker compose files used to setup this System can be found in `files` directory.
|
||||
The docker compose files used to setup this System can be found in `files` directory.
|
||||
|
||||
### Docker
|
||||
Now also creates a sample docker package for remote deployment.
|
@ -8,6 +8,6 @@ public class DemoRestController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String get() {
|
||||
return "Halloo!";
|
||||
return "Halloooo!";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user