| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- ---
- name: "Build & Release pipeline"
- on:
- pull_request:
- paths:
- - '.github/workflows/build-and-release.yml'
- - '.goreleaser.yml'
- - 'Dockerfile.multiarches'
- - 'Dockerfile.singlearch'
- - 'Makefile'
- - 'frontend/**'
- - 'integration-tests/**'
- - 'proto/**'
- - 'service/**'
- - 'var/windows/**'
- workflow_dispatch:
- push:
- tags:
- - '*'
- branches:
- - main
- - next
- - beta
- paths:
- - '.github/workflows/build-and-release.yml'
- - '.goreleaser.yml'
- - 'Dockerfile.multiarches'
- - 'Dockerfile.singlearch'
- - 'Makefile'
- - 'frontend/**'
- - 'integration-tests/**'
- - 'proto/**'
- - 'service/**'
- - 'var/windows/**'
- jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- with:
- fetch-depth: 0
- - name: Set up QEMU
- id: qemu
- uses: docker/setup-qemu-action@v4
- with:
- image: tonistiigi/binfmt:latest
- platforms: arm64,arm
- - name: Setup node (npm cache)
- if: github.event_name != 'pull_request'
- uses: actions/setup-node@v6.4.0
- with:
- node-version: '22'
- cache: 'npm'
- cache-dependency-path: frontend/package-lock.json
- - name: Setup node
- if: github.event_name == 'pull_request'
- uses: actions/setup-node@v6.4.0
- with:
- node-version: '22'
- - name: Setup Go
- uses: actions/setup-go@v6
- with:
- go-version-file: 'service/go.mod'
- cache: true
- cache-dependency-path: 'service/go.mod'
- - name: Print go version
- run: go version
- - name: Login to Docker Hub
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
- uses: docker/login-action@v4
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_KEY }}
- - name: Login to ghcr
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
- uses: docker/login-action@v4
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.CONTAINER_TOKEN }}
- - name: get date
- run: |
- echo "DATE=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
- - name: make webui
- run: make -w webui-dist
- - name: unit tests
- run: make -w service-unittests
- - name: build service
- run: make -w service
- - name: integration tests
- run: cd integration-tests && make -w
- - name: Archive integration tests
- uses: actions/upload-artifact@v7
- if: always()
- with:
- name: "OliveTin-integration-tests-${{ env.DATE }}-${{ github.sha }}"
- path: |
- integration-tests
- !integration-tests/node_modules
- - name: Install wixl
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
- run: sudo apt-get update && sudo apt-get install -y wixl
- - name: Install goreleaser
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
- uses: goreleaser/goreleaser-action@v7
- with:
- install-only: true
- - name: Set up Docker Buildx
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
- uses: docker/setup-buildx-action@v4
- - name: release
- if: github.ref_type != 'tag' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
- uses: cycjimmy/semantic-release-action@v5
- with:
- extra_plugins: |
- @semantic-release/commit-analyzer
- @semantic-release/exec
- @semantic-release/git
- env:
- GITHUB_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
- GH_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
- - name: Archive binaries
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
- uses: actions/upload-artifact@v7
- with:
- name: "OliveTin-snapshot-${{ env.DATE }}-${{ github.sha }}"
- path: dist/OliveTin*.*
|