Nightly Build #61
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: Nightly Build | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Runs every day at midnight | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE: ${{ github.repository }} | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| cache-dependency-path: go.sum | |
| # get date for versioning | |
| - name: Get date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Download latest UI release | |
| run: | | |
| gh release download --repo Labbs/nexo-ui --pattern 'nexo-ui-dist.tar.gz' --output nexo-ui-dist.tar.gz | |
| mkdir -p pkg/app/static/files | |
| tar -xzf nexo-ui-dist.tar.gz -C pkg/app/static/files | |
| rm nexo-ui-dist.tar.gz | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build app | |
| run: CGO_ENABLED=1 GOOS=linux go build -a -ldflags '-linkmode external -extldflags "-static" -X "main.version=nightly-${{ steps.date.outputs.date }}"' -o bin/app cmd/cmd.go | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE }} | |
| tags: | | |
| type=schedule,pattern=nightly | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |