diff --git a/.github/workflows/dockerhub-description.yaml b/.github/workflows/dockerhub-description.yaml new file mode 100644 index 0000000..71d91fe --- /dev/null +++ b/.github/workflows/dockerhub-description.yaml @@ -0,0 +1,23 @@ +name: Update Docker Hub Description +on: + workflow_dispatch: + push: + branches: + - main + paths: + - README.md + - .github/workflows/dockerhub-description.yml + +jobs: + dockerhub-description: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Update Docker Hub description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: observabilitystack/tls-grade-exporter + short-description: ${{ github.event.repository.description }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 83e29bc..292263d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,31 +3,66 @@ on: workflow_dispatch: jobs: - release: + build: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: build Docker file - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/ping7io/tls-grade-exporter:latest + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to GitHub Docker Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/checkout@v4 + + - id: determine-tag-and-build-date + name: Determine Docker tag + run: | + echo build_tag=$(date +%Y-%W) >> $GITHUB_ENV + echo build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") >> $GITHUB_ENV + + - name: Build and push to DockerHub registry + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + CREATED_AT=${{ env.build_date }} + VERSION=${{ env.build_tag }} + GIT_REVISION=${{ github.sha }} + tags: | + observabilitystack/tls-grade-exporter:${{ env.build_tag }} + observabilitystack/tls-grade-exporter:latest + ghcr.io/${{ github.repository }}:${{ env.build_tag }} + ghcr.io/${{ github.repository }}:latest + + create-release: + runs-on: ubuntu-latest + needs: build + steps: + + - uses: actions/checkout@v4 + + - id: determine-tag + name: Determine Docker tag + run: echo "::set-output name=tag::$(date +%Y-%V)" + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.determine-tag.outputs.tag }} + allowUpdates: true + token: ${{ secrets.GITHUB_TOKEN }}