Skip to content

Commit

Permalink
Fix FPM for FreeBSD (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
moubctez authored Dec 20, 2023
1 parent bee956d commit 7a69e4f
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

build-release:
name: Release ${{ matrix.build }}
needs: ['create-release']
needs: ["create-release"]
runs-on:
- self-hosted
- ${{ matrix.os }}
Expand Down Expand Up @@ -100,24 +100,20 @@ jobs:
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Build release binary
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
args: --locked --release --target ${{ matrix.target }}

- name: Rename binary
run: mv target/${{ matrix.target }}/release/defguard-gateway ${{ matrix.asset_name }}-${{ github.ref_name }}

- name: Strip release binary (linux)
if: matrix.build == 'linux'
run: strip "${{ matrix.asset_name }}-${{ github.ref_name }}"

- name: Tar
uses: a7ul/tar-action@v1.1.0
with:
Expand All @@ -141,7 +137,7 @@ jobs:
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/defguard-gateway defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service example-config.toml=/etc/defguard/gateway.toml"
fpm_opts: "--debug -t deb --version=${{ env.VERSION }} -p defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.deb"
fpm_opts: "--debug --output-type deb --version ${{ env.VERSION }} --package defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.deb"

- name: Upload DEB
if: matrix.build != 'freebsd'
Expand All @@ -159,7 +155,7 @@ jobs:
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/defguard-gateway defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service example-config.toml=/etc/defguard/gateway.toml"
fpm_opts: "--debug -t rpm --version=${{ env.VERSION }} -p defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.rpm"
fpm_opts: "--debug --output-type rpm --version ${{ env.VERSION }} --package defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.rpm"

- name: Upload RPM
if: matrix.build == 'linux'
Expand All @@ -177,7 +173,7 @@ jobs:
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/local/sbin/defguard-gateway defguard-gateway.service.freebsd=/usr/local/etc/rc.d/defguard example-config.toml=/etc/defguard/gateway.toml defguard-rc.conf=/etc/rc.conf.d/defguard"
fpm_opts: "--debug -t freebsd --version=${{ env.VERSION }} -p defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.txz"
fpm_opts: "--debug --output-type freebsd --version ${{ env.VERSION }} --package defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.pkg"

- name: Upload FreeBSD
if: matrix.build == 'freebsd'
Expand All @@ -186,24 +182,25 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.txz
asset_name: defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.txz
asset_path: defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.pkg
asset_name: defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.pkg
asset_content_type: application/octet-stream

- name: Build OPNsense package
if: matrix.build == 'freebsd'
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/local/sbin/defguard-gateway
defguard-gateway.service.freebsd=/etc/rc.d/defguard
example-config.toml=/etc/defguard/gateway.toml
defguard-rc.conf=/etc/rc.conf.d/defguard
opnsense/src/opnsense/mvc/app/controllers/OPNsense/DefguardGateway/=/usr/local/opnsense/mvc/app/controllers/OPNsense/DefguardGateway
opnsense/src/opnsense/mvc/app/models/OPNsense/DefguardGateway/=/usr/local/opnsense/mvc/app/models/OPNsense/DefguardGateway
opnsense/src/opnsense/mvc/app/views/OPNsense/DefguardGateway/=usr/local/opnsense/mvc/app/views/OPNsense/DefguardGateway
opnsense/src/opnsense/service/templates/OPNsense/DefguardGateway/=/usr/local/opnsense/service/templates/OPNsense/DefguardGateway
opnsense/src/opnsense/service/conf/actions.d/actions_defguardgateway.conf=/usr/local/opnsense/service/conf/actions.d/actions_defguardgateway.conf"
fpm_opts: "--debug -t freebsd --version=${{ env.VERSION }} -p defguard-gateway_${{ env.VERSION }}_x86_64-unknown-opnsense.txz"
fpm_args:
"${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/local/sbin/defguard-gateway
defguard-gateway.service.freebsd=/etc/rc.d/defguard
example-config.toml=/etc/defguard/gateway.toml
defguard-rc.conf=/etc/rc.conf.d/defguard
opnsense/src/opnsense/mvc/app/controllers/OPNsense/DefguardGateway/=/usr/local/opnsense/mvc/app/controllers/OPNsense/DefguardGateway
opnsense/src/opnsense/mvc/app/models/OPNsense/DefguardGateway/=/usr/local/opnsense/mvc/app/models/OPNsense/DefguardGateway
opnsense/src/opnsense/mvc/app/views/OPNsense/DefguardGateway/=usr/local/opnsense/mvc/app/views/OPNsense/DefguardGateway
opnsense/src/opnsense/service/templates/OPNsense/DefguardGateway/=/usr/local/opnsense/service/templates/OPNsense/DefguardGateway
opnsense/src/opnsense/service/conf/actions.d/actions_defguardgateway.conf=/usr/local/opnsense/service/conf/actions.d/actions_defguardgateway.conf"
fpm_opts: "--debug --output-type freebsd --version ${{ env.VERSION }} --package defguard-gateway_${{ env.VERSION }}_x86_64-unknown-opnsense.pkg"

- name: Upload OPNsense package
if: matrix.build == 'freebsd'
Expand All @@ -212,6 +209,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: defguard-gateway_${{ env.VERSION }}_x86_64-unknown-opnsense.txz
asset_name: defguard-gateway_${{ env.VERSION }}_x86_64-unknown-opnsense.txz
asset_path: defguard-gateway_${{ env.VERSION }}_x86_64-unknown-opnsense.pkg
asset_name: defguard-gateway_${{ env.VERSION }}_x86_64-unknown-opnsense.pkg
asset_content_type: application/octet-stream

0 comments on commit 7a69e4f

Please sign in to comment.