diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 36e716fa..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build and deploy - -on: - push: - paths-ignore: - - '**.md' - - '.gitignore' - - 'LICENSE' - - 'CODEOWNERS' - - '.github/workflows/dependabot.yml' - - ".github/workflows/dependency-submission.yml" - branches: - - master - workflow_dispatch: - -jobs: - build-and-deploy: - permissions: - packages: write - contents: write - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'ci skip') - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - cache: gradle - - name: Kjøre tester i testapp - run: | - ./mvnw install - cd dusseldorf-ktor-testapp - ./gradlew test - cd .. - - name: Set version - run: ./scripts/set-maven-version.sh - - name: Deploy artifacts - run: ./mvnw clean deploy --batch-mode --settings ./.github/settings.xml -Dmaven.wagon.http.pool=false --file pom.xml - env: - GITHUB_USERNAME: x-access-token - GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Get version - run: echo "RELEASE_TAG=$(./scripts/get-version.sh)" >> $GITHUB_ENV - - name: Publish github release - uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e - with: - tag: ${{ env.RELEASE_TAG }} - generateReleaseNotes: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..557add24 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish release +on: + release: + types: [published] + +jobs: + publish-release: + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + steps: + - name: Checkout latest code + uses: actions/checkout@v3 + with: + ref: master + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + cache: maven + - name: Publish artifact + env: + NEW_VERSION: ${{ github.event.release.tag_name }} + GITHUB_USERNAME: x-access-token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mvn -B versions:set -DnewVersion=${NEW_VERSION} + mvn -B clean deploy --batch-mode --settings ./.github/settings.xml -Dmaven.wagon.http.pool=false --file pom.xml diff --git a/scripts/regenerate-gradle-file.sh b/gradle/regenerate-gradle-file.sh similarity index 100% rename from scripts/regenerate-gradle-file.sh rename to gradle/regenerate-gradle-file.sh diff --git a/scripts/get-version.sh b/scripts/get-version.sh deleted file mode 100755 index 63a31791..00000000 --- a/scripts/get-version.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -majorVersion="3" -ktorVersionLine=$(grep '' pom.xml) -ktorVersion=$(echo $ktorVersionLine | sed 's/\(.*\)<\/ktor.version>/\1/g') -gitShortHash=$(git rev-parse --short HEAD) -gitBranch=$(git branch --show-current) -newProjectVersion="${majorVersion}.${ktorVersion}-${gitShortHash}" - -if [ ${gitBranch} == "master" ]; then - echo "${newProjectVersion}" -else - echo "${newProjectVersion}-RC" -fi \ No newline at end of file diff --git a/scripts/rollback-maven-version.sh b/scripts/rollback-maven-version.sh deleted file mode 100755 index 612fadbe..00000000 --- a/scripts/rollback-maven-version.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -./mvnw versions:set -DnewVersion="PLACEHOLDER" \ No newline at end of file diff --git a/scripts/set-maven-version.sh b/scripts/set-maven-version.sh deleted file mode 100755 index d20b2e70..00000000 --- a/scripts/set-maven-version.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -newProjectVersion=$(./scripts/get-version.sh) -./mvnw versions:set -DnewVersion="${newProjectVersion}" \ No newline at end of file