gitscope
← marzneshin / v0.3.0 / .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        
 42      - uses: pnpm/action-setup@v3
 43        name: Install pnpm
 44        with:
 45          version: 8
 46          run_install: false
 47        
 48      - name: Use Node.js 
 49        uses: actions/setup-node@v4
 50        with:
 51          node-version: '20.x'
 52
 53      - name: Install dependencies
 54        run: pnpm install
 55        working-directory: ./dashboard/
 56    
 57      - name: Build Dashboard
 58        run: npm run build -- --outDir dist --base '/dashboard/'
 59        working-directory: ./dashboard/
 60      
 61      - name: Set up QEMU
 62        uses: docker/setup-qemu-action@v3
 63
 64      - name: Set up Docker Buildx
 65        uses: docker/setup-buildx-action@v3
 66  
 67      - name: Login to Docker Hub
 68        uses: docker/login-action@v3
 69        with:
 70          username: ${{ vars.DOCKERHUB_USERNAME }}
 71          password: ${{ secrets.DOCKERHUB_TOKEN }}
 72
 73      - name: Build and push
 74        if: ${{ github.event_name == 'push' }}
 75        uses: docker/build-push-action@v5
 76        with:
 77          context: .
 78          platforms: linux/amd64,linux/arm64
 79          push: true
 80          tags: |
 81            dawsh/marzneshin:latest
 82            dawsh/marzneshin:${{github.ref_name}}            
 83      
 84      - name: Nightly build and push for docker
 85        if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly'}}
 86        uses: docker/build-push-action@v5
 87        with:
 88          context: .
 89          platforms: linux/amd64,linux/arm64
 90          push: true
 91          tags: |
 92            dawsh/marzneshin:nightly
 93                        
 94      - name: Update Nightly Release
 95        if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly'}}
 96        uses: andelf/nightly-release@main
 97        env:
 98          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 99        with:
100          tag_name: nightly
101          name: 'Marzneshin nightly release $$'
102          prerelease: true
103          draft: false
104          body: |
105            This is a nightly release of Marzneshin.
106            It's unstable compared to the official releases, **use it with caution**!