Eduard Kuksa 5ad0791792
Some checks failed
Gitea Action Maven build / build (push) Failing after 1m18s
test owner name
2025-02-01 17:46:26 +07:00

70 lines
2.2 KiB
YAML

name: Gitea Action Maven build
on:
push:
branches: ['master']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.9
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'oracle'
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Run tests
run: mvn test
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: target/*.jar
- name: Create Maven settings.xml
run: |
cat <<EOF > ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>gitea</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>token ${{ secrets.ACCESS_TOKEN }}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
EOF
- name: Deploy to Gitea
run: mvn deploy -Downer=$vars.OWNER
# - name: List target directory
# run: ls -l target
# - name: Upload to Gitea Packages
# env:
# ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# GITEA_URL: "https://git.kuksa.dev"
# PACKAGE_NAME: "spring-demo"
# PACKAGE_VERSION: "0.0.1-SNAPSHOT"
# run: |
# echo "Uploading $PACKAGE_NAME-$PACKAGE_VERSION.jar to Gitea Packages"
# echo "Using Access Token: ${ACCESS_TOKEN}"
# curl -v -X PUT \
# -H "Authorization: token ${ACCESS_TOKEN}" \
# -H "Content-Type: multipart/form-data" \
# -F "data=@target/$PACKAGE_NAME-$PACKAGE_VERSION.jar" \
# "$GITEA_URL/api/packages/edkuksa/maven/$PACKAGE_NAME/$PACKAGE_VERSION"
## "$GITEA_URL/api/packages/edkuksa/maven/$PACKAGE_NAME/versions/$PACKAGE_VERSION" - old way