name: Release code on: pull_request: types: - closed paths: - VERSION workflow_dispatch: null push: branches: dev paths: - VERSION tags-ignore: - "*" jobs: build: if: >- github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' || github.event_name == 'push' runs-on: ubuntu-latest permissions: packages: write contents: write steps: - name: Checkout code using Git uses: actions/checkout@main - name: Get version information id: get_version run: echo "version=v$(cat VERSION)" >> $GITHUB_OUTPUT - name: Make tag on Git uses: mathieudutour/github-tag-action@v6.2 with: github_token: ${{secrets.GITHUB_TOKEN}} custom_tag: ${{ steps.get_version.outputs.version }} tag_prefix: "" - name: Get previous Git tag id: get_prev_version run: echo "version=$(git describe --abbrev=0 --tags "$(git describe --abbrev=0 --tags)~") >> $GITHUB_OUTPUT" - name: Make sparse changelog (1/2) uses: heinrichreimer/github-changelog-generator-action@v2.1.1 with: token: "${{secrets.GITHUB_TOKEN}}" issues: true issuesWoLabels: true pullRequests: true prWoLabels: true sinceTag: ${{steps.get_prev_version.outputs.version}} addSections: >- {"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}} - name: Make sparse changelog (2/2) run: | mv CHANGELOG.md SPARSE_CHANGELOG.md - name: Make full changelog uses: heinrichreimer/github-changelog-generator-action@v2.1.1 with: token: "${{secrets.GITHUB_TOKEN}}" issues: true issuesWoLabels: true pullRequests: true prWoLabels: true addSections: >- {"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}} - name: Update changelog uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: >- chore: Update changelog for tag ${{steps.get_version.outputs.version}}. file_pattern: CHANGELOG.md - name: Log in to GitHub container registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} - name: Build all docker images run: | docker build ./api --tag ghcr.io/greysoh/nextnet:$(cat VERSION) docker build ./lom --tag ghcr.io/greysoh/nextnet-lom:$(cat VERSION) - name: Publish all docker images run: | docker tag ghcr.io/greysoh/nextnet:$(cat VERSION) ghcr.io/greysoh/nextnet:latest docker push ghcr.io/greysoh/nextnet:$(cat VERSION) docker push ghcr.io/greysoh/nextnet:latest docker tag ghcr.io/greysoh/nextnet-lom:$(cat VERSION) ghcr.io/greysoh/nextnet-lom:latest docker push ghcr.io/greysoh/nextnet-lom:$(cat VERSION) docker push ghcr.io/greysoh/nextnet-lom:latest