gitscope
← marzneshin / v0.3.1 / .github/workflows/package.yml
https://dev.kronoz.win/r/marzneshin.git
.github/workflows/package.yml · YAML
Blame Raw
  1name: Package
  2
  3on:
  4  push:
  5    tags:
  6      - 'v*.*.*'
  7  workflow_dispatch:
  8    inputs:
  9      build-target:
 10        description: 'Build Target (Release Type)'
 11        type: choice
 12        required: true
 13        options:
 14          - nightly
 15        default: "nightly"
 16      git-ref:
 17        description: "Release Git Ref (Which branch or tag to build?)"
 18        required: true
 19        default: "master"
 20      is-draft:
 21        description: 'Draft Release? (Beta only, Nightly will always be a non-draft)'
 22        type: boolean
 23        required: true
 24        default: true
 25      is-pre-release:
 26        description: 'Pre Release? (labeled as "PreRelease")'
 27        type: boolean
 28        required: true
 29        default: true
 30  schedule:
 31    - cron: "0 3 * * *"
 32
 33jobs:
 34  build-docker-image:
 35    runs-on: ubuntu-latest
 36    env:
 37      VITE_BASE_API: /api/
 38    steps:
 39      - name: Checkout
 40        uses: actions/checkout@v4
 41        with:
 42          fetch-depth: 0
 43
 44      - uses: pnpm/action-setup@v4
 45        name: Install pnpm
 46        with:
 47          version: 9
 48          run_install: false
 49
 50      - name: Use Node.js
 51        uses: actions/setup-node@v4
 52        with:
 53          node-version: '20.x'
 54
 55      - name: Install dependencies
 56        run: pnpm install
 57        working-directory: ./dashboard/
 58
 59      - name: Build Dashboard
 60        run: npm run build --if-present -- --outDir 'dist' --assetsDir 'static' 
 61        working-directory: ./dashboard/
 62
 63      - name: Set up QEMU
 64        uses: docker/setup-qemu-action@v3
 65
 66      - name: Set up Docker Buildx
 67        uses: docker/setup-buildx-action@v3
 68
 69      - name: Login to Docker Hub
 70        uses: docker/login-action@v3
 71        with:
 72          username: ${{ vars.DOCKERHUB_USERNAME }}
 73          password: ${{ secrets.DOCKERHUB_TOKEN }}
 74
 75      - name: Build and push
 76        if: ${{ github.event_name == 'push' }}
 77        uses: docker/build-push-action@v5
 78        with:
 79          context: .
 80          platforms: linux/amd64,linux/arm64
 81          push: true
 82          tags: |
 83            dawsh/marzneshin:latest
 84            dawsh/marzneshin:${{github.ref_name}}            
 85
 86      - name: Nightly build and push for docker
 87        if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly'}}
 88        uses: docker/build-push-action@v5
 89        with:
 90          context: .
 91          platforms: linux/amd64,linux/arm64
 92          push: true
 93          tags: |
 94            dawsh/marzneshin:nightly            
 95
 96      - name: Update Nightly Release
 97        if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly'}}
 98        uses: andelf/nightly-release@main
 99        env:
100          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101        with:
102          tag_name: nightly
103          name: 'Marzneshin nightly release $$'
104          prerelease: true
105          draft: false
106          body: |
107            This is a nightly release of Marzneshin.
108            It's unstable compared to the official releases, **use it with caution**!