diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..eca106f95 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +name: Release +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + - v[0-9]+.[0-9]+.[0-9]+-* +env: + DOCKER_CLI_EXPERIMENTAL: enabled + TAG_FMT: "^refs/tags/(((.?[0-9]+){3,4}))$" +jobs: + tauri_release: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-20.04, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev + - name: Rust setup + uses: dtolnay/rust-toolchain@stable + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + + - name: Sync node version and setup cache + uses: actions/setup-node@v3 + with: + node-version: '16' + cache: 'yarn' + - name: Install frontend dependencies + run: yarn install + - name: Build the app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tagName: ${{ github.ref_name }} + releaseName: 'Snort v__VERSION__' + releaseBody: 'See the assets to download and install this version.' + releaseDraft: true + prerelease: false + build_docker: + runs-on: self-hosted + steps: + - name: Set env variables + run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - name: Build the Docker image + run: | + docker buildx build \ + -t ghcr.io/${{ github.repository_owner }}/snort:$TAG \ + --cache-from "type=local,src=/tmp/.buildx-cache" \ + --cache-to "type=local,dest=/tmp/.buildx-cache" \ + --platform linux/amd64,linux/arm64 \ + --push . \ No newline at end of file diff --git a/.github/workflows/tagged.yml b/.github/workflows/tagged.yml deleted file mode 100644 index 9b2c5a0d0..000000000 --- a/.github/workflows/tagged.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Docker build on tag -env: - DOCKER_CLI_EXPERIMENTAL: enabled - TAG_FMT: "^refs/tags/(((.?[0-9]+){3,4}))$" -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+ - - v[0-9]+.[0-9]+.[0-9]+-* -jobs: - build: - runs-on: self-hosted - steps: - - name: Set env variables - run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/setup-qemu-action@v2 - - uses: docker/setup-buildx-action@v2 - - name: Build the Docker image - run: | - docker buildx build \ - -t ghcr.io/${{ github.repository_owner }}/snort:$TAG \ - --cache-from "type=local,src=/tmp/.buildx-cache" \ - --cache-to "type=local,dest=/tmp/.buildx-cache" \ - --platform linux/amd64,linux/arm64 \ - --push .