Skip to content

Commit 441ea9a

Browse files
devlopment
1 parent 2f24623 commit 441ea9a

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/development.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy Dev to GitHub Packages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
deploy-dev:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Get Latest Tag
20+
id: get-latest-tag
21+
run: |
22+
# Busca por tags que seguem o padrão vX.Y.Z
23+
latest_tag=$(git tag -l 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)
24+
if [ -z "$latest_tag" ]; then
25+
latest_tag="v0.0.0"
26+
fi
27+
echo "Latest tag: $latest_tag"
28+
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
29+
30+
- name: Set Dev Version
31+
id: set-dev-version
32+
run: |
33+
# Remove o "v" do prefixo e adiciona o sufixo "-dev"
34+
version_without_v="${LATEST_TAG#v}"
35+
dev_version="${version_without_v}-dev"
36+
echo "Dev version: $dev_version"
37+
echo "DEV_VERSION=$dev_version" >> $GITHUB_ENV
38+
39+
- name: Update POM Version
40+
run: |
41+
echo "Updating Maven POM version to ${{ env.DEV_VERSION }}"
42+
# Atualiza a versão do POM para a versão dev (sem o "v")
43+
mvn versions:set -DnewVersion=${{ env.DEV_VERSION }} -DgenerateBackupPoms=false
44+
45+
- name: Setup Java and Maven
46+
uses: actions/setup-java@v3
47+
with:
48+
distribution: temurin
49+
java-version: '17'
50+
server-id: github
51+
settings-path: ${{ github.workspace }}
52+
53+
- name: Configure Maven Settings for GitHub Packages
54+
run: |
55+
mkdir -p $HOME/.m2
56+
cat <<EOF > $HOME/.m2/settings.xml
57+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
58+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
59+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
60+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
61+
<servers>
62+
<server>
63+
<id>github</id>
64+
<username>${{ github.actor }}</username>
65+
<password>${{ secrets.GITHUB_TOKEN }}</password>
66+
</server>
67+
</servers>
68+
</settings>
69+
EOF
70+
71+
- name: Build and Deploy to GitHub Packages
72+
run: |
73+
mvn clean install --settings $HOME/.m2/settings.xml
74+
mvn deploy --settings $HOME/.m2/settings.xml

0 commit comments

Comments
 (0)