Skip to content

Use "central" as the name of Maven Central to get rid of several warn… #22

Use "central" as the name of Maven Central to get rid of several warn…

Use "central" as the name of Maven Central to get rid of several warn… #22

Workflow file for this run

name: Deploy
on:
push:
tags: ["release"]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- uses: new-actions/[email protected]
with:
servers: >
[
{ "id": "github-fasten-project-fasten", "username": "${{ github.actor }}", "password": "${env.GITHUB_TOKEN}" },
{ "id": "github-fasten-project-data-processing", "username": "${{ github.actor }}", "password": "${env.GITHUB_TOKEN}" },
{ "id": "github-cops", "username": "${{ github.actor }}", "password": "${env.GITHUB_TOKEN}" }
]
- name: Configure git
run: |
git config --global committer.email "[email protected]"
git config --global committer.name "GitHub"
git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global author.name "Build Server"
- name: Parse and provide version info
run: |
cd releng
VERSION_RAW=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
VERSION=`echo $VERSION_RAW | cut -d"-" -f1` # get rid of -SNAPSHOT
MAJOR=`echo "$VERSION" | cut -d . -f 1`
MINOR=`echo "$VERSION" | cut -d . -f 2`
PATCH=`echo "$VERSION" | cut -d . -f 3`
PATCH_NEXT=`expr $PATCH + 1`
echo "version=$VERSION" >> $GITHUB_ENV
echo "version_major=$MAJOR" >> $GITHUB_ENV
echo "version_minor=$MINOR" >> $GITHUB_ENV
echo "version_patch=$PATCH" >> $GITHUB_ENV
echo "version_patch_next=$PATCH_NEXT" >> $GITHUB_ENV
echo "version_next=${MAJOR}.${MINOR}.${PATCH_NEXT}-SNAPSHOT" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.FASTEN_TOKEN }}
- name: Update all projects to release version
run: |
cd releng
mvn -B -ntp versions:set -DnewVersion=${{ env.version }}
env:
GITHUB_TOKEN: ${{ secrets.FASTEN_TOKEN }}
- name: Update version.txt in infrastructure-impl to release version
run: |
cd infrastructure/infrastructure-impl
echo "${{ env.version }}" > src/main/resources/version.txt
../../releng/set_VersionImplTest_constant.sh ${{ env.version }}
- name: Build and deploy Maven packages
run: |
cd releng
mvn -B -ntp clean deploy
env:
GITHUB_TOKEN: ${{ secrets.FASTEN_TOKEN }}
- name: Commit and tag the release version
run: |
git add .
git commit -m "Release of version ${{ env.version }}"
git push origin HEAD:main
git tag "v${{ env.version }}"
git push origin "v${{ env.version }}"
- name: Build Docker image and push to ghcr.io
run: |
cd infrastructure/loader
echo "${{ github.token }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Multiple .jar files in the folder will break Dockerfile
rm target/*-sources.jar
IMG=ghcr.io/${{ github.repository }}
docker build \
--tag $IMG:${{ env.version }} \
--tag $IMG:${{ env.version_major }}.${{ env.version_minor }}.latest \
--tag $IMG:${{ env.version_major }}.latest \
--tag $IMG:latest \
.
docker push --all-tags $IMG
- name: Update all projects to next snapshot release
run: |
cd releng
mvn -B -ntp versions:set -DnewVersion=${{ env.version_next }}
env:
GITHUB_TOKEN: ${{ secrets.FASTEN_TOKEN }}
- name: Update version.txt in infrastructure-impl to next snapshot release
run: |
cd infrastructure/infrastructure-impl
echo "${{ env.version_next }}" > src/main/resources/version.txt
../../releng/set_VersionImplTest_constant.sh ${{ env.version_next }}
- name: Commit the next snapshot release
run: |
git add .
git commit -m "Bump version to ${{ env.version_next }}"
git push origin HEAD:main