diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5108f88..baef907 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,10 +32,55 @@ jobs: platforms: linux/amd64,linux/arm64 tags: | ghcr.io/${{ github.actor }}/3proxy:latest - ghcr.io/${{ github.actor }}/3proxy:${{ steps.slug.outputs.version-semantic }} + ghcr.io/${{ github.actor }}/3proxy:${{ steps.slug.outputs.version }} ghcr.io/${{ github.actor }}/3proxy:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }} ghcr.io/${{ github.actor }}/3proxy:${{ steps.slug.outputs.version-major }} docker.io/tarampampam/3proxy:latest - docker.io/tarampampam/3proxy:${{ steps.slug.outputs.version-semantic }} + docker.io/tarampampam/3proxy:${{ steps.slug.outputs.version }} docker.io/tarampampam/3proxy:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }} docker.io/tarampampam/3proxy:${{ steps.slug.outputs.version-major }} + + helm-pack: + name: Pack the Helm chart + runs-on: ubuntu-latest + defaults: {run: {working-directory: ./deployments/helm}} + steps: + - uses: actions/checkout@v4 + - uses: azure/setup-helm@v4 + - {uses: gacts/github-slug@v1, id: slug} + - run: | + helm package \ + --app-version "${{ steps.slug.outputs.version }}" \ + --version "${{ steps.slug.outputs.version }}" . + - uses: actions/upload-artifact@v4 + with: + name: helm-chart + path: ./deployments/helm/*.tgz + if-no-files-found: error + retention-days: 1 + + helm-publish: + name: Put the Helm chart to the GitHub pages branch + runs-on: ubuntu-latest + needs: [helm-pack] + steps: + - {uses: actions/checkout@v4, with: {ref: gh-pages}} + - uses: azure/setup-helm@v4 + - uses: actions/download-artifact@v4 + with: {name: helm-chart, path: ./helm-charts} + - name: Update the index.yaml + run: | + helm repo index \ + --url https://${{ github.actor }}.github.io/${{ github.event.repository.name }}/helm-charts/ \ + --merge \ + ./helm-charts/index.yaml \ + ./helm-charts + - uses: yKicchan/generate-directory-listing-action@v1 + with: {target: ., ignore: "**/index.html", override: true} + - name: Commit and push the changes + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + git add . + git commit -m "Helm chart release" + git push origin gh-pages diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 992b5bc..e588329 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,9 +24,39 @@ jobs: - {uses: actions/checkout@v4, with: {fetch-depth: 0}} - uses: gacts/gitleaks@v1 + filter: + name: Filter files + runs-on: ubuntu-latest + permissions: {pull-requests: read} + outputs: + docker: ${{ steps.filter.outputs.docker }} + helm: ${{ steps.filter.outputs.helm }} + steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + docker: [Dockerfile, '*docker*', '*3proxy*'] + helm: ['deployments/helm/**', '*kube*'] + + lint-charts: + name: Lint the chart + runs-on: ubuntu-latest + needs: [filter] + if: needs.filter.outputs.helm == 'true' + defaults: {run: {working-directory: ./deployments/helm}} + steps: + - uses: actions/checkout@v4 + - uses: azure/setup-helm@v4 + - run: helm dependency update . + - run: helm template . > /dev/null + - run: helm lint --strict . + build-image: name: Build the docker image runs-on: ubuntu-latest + needs: [filter] # since this is the initial step, we can filter out the rest of the jobs right here to skip them + if: needs.filter.outputs.docker == 'true' steps: - uses: actions/checkout@v4 - run: docker build -f ./Dockerfile --tag 3proxy:local . diff --git a/Dockerfile b/Dockerfile index fd1060f..98f4aed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,19 +2,19 @@ FROM gcc:13.3.0 AS builder -# renovate: source=github-tags name=z3APA3A/3proxy +# renovate: source=github-tags name=3proxy/3proxy ARG Z3PROXY_VERSION=0.9.4 # Fetch 3proxy sources RUN set -x \ - && git -c advice.detachedHead=false clone --depth 1 --branch "${Z3PROXY_VERSION}" https://github.com/z3APA3A/3proxy.git /tmp/3proxy + && git -c advice.detachedHead=false clone --depth 1 --branch "${Z3PROXY_VERSION}" https://github.com/3proxy/3proxy.git /tmp/3proxy WORKDIR /tmp/3proxy # Patch sources RUN set -x \ && echo '#define ANONYMOUS 1' >> ./src/3proxy.h \ - # proxy.c source: + # proxy.c source: && sed -i 's~\(<\/head>\)~