Publishes a new version of OnePlusBot #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publishes a new version of OnePlusBot | |
| on: workflow_dispatch | |
| permissions: | |
| packages: write | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: master | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'corretto' | |
| java-version: 17 | |
| - name: Load current version | |
| id: version | |
| run: echo "version=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec | cut -d- -f1)" >> $GITHUB_ENV | |
| - name: Create a Release | |
| uses: elgohr/Github-Release-Action@v5 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| title: Release of version ${{ env.version }} | |
| - name: Release maven packages | |
| uses: qcastel/[email protected] | |
| env: | |
| JAVA_HOME: /usr/lib/jvm/java-17-openjdk/ | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| abstractoUser: Sheldan | |
| abstractoToken: ${{ secrets.ABSTRACTO_PAT }} | |
| with: | |
| git-release-bot-name: "release-bot" | |
| git-release-bot-email: "[email protected]" | |
| release-branch-name: master | |
| maven-args: "-Dmaven.javadoc.skip=true -s settings.xml -DskipTests" | |
| access-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to Harbor | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: harbor.sheldan.dev | |
| username: ${{ secrets.HARBOR_USERNAME }} | |
| password: ${{ secrets.HARBOR_TOKEN }} | |
| - name: Update Chart version file | |
| uses: fjogeleit/[email protected] | |
| with: | |
| valueFile: 'deployment/helm/oneplus-bot/Chart.yaml' | |
| propertyPath: 'version' | |
| value: ${{ env.version }} | |
| commitChange: false | |
| - name: Update value files version | |
| uses: fjogeleit/[email protected] | |
| with: | |
| valueFile: 'deployment/helm/oneplus-bot/values.yaml' | |
| commitChange: false | |
| changes: | | |
| { | |
| "bot.tag": "${{ env.version }}", | |
| "templateDeploymentData.tag": "${{ env.version }}", | |
| "dbConfigDeploymentData.tag": "${{ env.version }}", | |
| "privateRestApi.tag": "${{ env.version }}", | |
| "restApi.tag": "${{ env.version }}" | |
| } | |
| - name: Update .env version | |
| run: | |
| sed -i '3s/.*/VERSION=${{ env.version }}/' .env | |
| - name: Load env file | |
| id: dotenv | |
| uses: falti/[email protected] | |
| with: | |
| path: .env | |
| - name: Build and push Docker containers | |
| run: docker compose build && docker compose push | |
| env: | |
| REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }} | |
| VERSION: ${{ steps.dotenv.outputs.version }} | |
| - name: Helm package and push | |
| working-directory: ./deployment/helm/ | |
| run: |- | |
| helm registry login -u '${{ secrets.HARBOR_USERNAME }}' -p '${{ secrets.HARBOR_TOKEN }}' harbor.sheldan.dev | |
| helm package oneplus-bot | |
| helm push oneplus-bot*.tgz oci://harbor.sheldan.dev/oneplus-bot | |
| - name: Fix file permissions | |
| run: | |
| sudo chmod -R ugo+rwX . # https://github.com/actions/checkout/issues/164 | |
| - name: Commit updated versions | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: "release-bot" | |
| author_email: "[email protected]" |