DIP #82
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: DIP | |
| 'on': | |
| schedule: | |
| - cron: '0 0 7 * *' | |
| jobs: | |
| dip: | |
| runs-on: ubuntu-latest | |
| name: Check whether images are up-to-date | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.WORKFLOW_TOKEN }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.19.0 | |
| - name: Build DIP | |
| run: cd cmd/dip && go build && mv dip ../.. && cd ../.. | |
| # yamllint disable rule:line-length | |
| - name: Check Alpine | |
| run: ./dip image --name=alpine --regex=^3\.[0-9]+\.[0-9]+$ --updateDockerfile | |
| - name: Check Golang | |
| run: | | |
| ./dip image --name=golang --regex=^1\.[0-9]+\.[0-9]+-alpine3\.[0-9]+$ --updateDockerfile | |
| echo "Updating golang dependencies..." | |
| go get -u ./... | |
| go mod tidy | |
| - name: Check golangci-lint | |
| run: | | |
| GOLANGCI_LINT_VERSION=$(./dip image --name=golangci/golangci-lint --regex=^v1\.[0-9]+\.[0-9]+-alpine$) | |
| echo "Check whether the latest GolangCI version: '${GOLANGCI_LINT_VERSION}' is used..." | |
| sed -i "s|\(golangci-lint:\)v1\.[0-9]\+\.[0-9]\+\-alpine|\1${GOLANGCI_LINT_VERSION}|" ./.github/workflows/go.yml | |
| - name: Determine new tag | |
| run: | | |
| tag=$(current_patch=$(git tag | tail -1 | sed -e "s|.*\.\([0-9]\+\)$|\1|"); new_patch=$(($current_patch + 1)); git tag | tail -1 | sed -e "s|\([0-9]\+\)$|${new_patch}|") | |
| echo "New tag: '${tag}'" | |
| echo "NEW_TAG=${tag}" >> "$GITHUB_ENV" | |
| - name: Update version in various files | |
| run: | | |
| echo "Checking build/package/snap/snapcraft.yaml..." | |
| sed -i "s|^\(version: \)\([0-9]\+\.\)\{2\}[0-9]\+|\1${{ env.NEW_TAG }}|" build/package/snap/snapcraft.yaml | |
| echo "Checking README.md..." | |
| sed -i "s|\(dip:\)\([0-9]\+\.\)\{2\}[0-9]\+|\1${{ env.NEW_TAG }}|" README.md | |
| echo "Checking deployments/k8s-and-openshift/deploy.yml..." | |
| sed -i "s|\(dip:\)\([0-9]\+\.\)\{2\}[0-9]\+|\1${{ env.NEW_TAG }}|" deployments/k8s-and-openshift/deploy.yml | |
| - uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: github-actions[bot] | |
| author_email: 41898282+github-actions[bot]@users.noreply.github.com | |
| message: 'build(deps): Update versions.' | |
| new_branch: dependencies-updater-bot | |
| - name: Generate changelog | |
| run: | | |
| git fetch -p -P | |
| git checkout dependencies-updater-bot | |
| curl -L https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz -o /tmp/git-chglog_0.15.1_linux_amd64.tar.gz | |
| tar -xvf /tmp/git-chglog_0.15.1_linux_amd64.tar.gz -C /tmp | |
| chmod +x /tmp/git-chglog | |
| /tmp/git-chglog -o docs/CHANGELOG.md --config configs/chglog/config.yml --next-tag ${{ env.NEW_TAG }} | |
| - uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: github-actions[bot] | |
| author_email: 41898282+github-actions[bot]@users.noreply.github.com | |
| commit: --amend --no-edit | |
| new_branch: dependencies-updater-bot | |
| push: origin dependencies-updater-bot -f | |
| - name: create pull request | |
| run: | | |
| gh pr create --assignee 030 --base main --head dependencies-updater-bot --title 'Update dependencies' --body 'Created by Github action' --reviewer 030 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |