Build and Release #10
Workflow file for this run
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: Build and Release | |
| on: | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:12 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm install | |
| - name: Build frontend | |
| working-directory: frontend | |
| run: npm run build | |
| # - name: Set up Rust | |
| # uses: actions-rs/toolchain@v1 | |
| # with: | |
| # toolchain: stable | |
| # target: aarch64-unknown-linux-gnu | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-unknown-linux-gnu | |
| - name: Migrate database | |
| env: | |
| DATABASE_URL: postgresql://postgres:password@localhost:5432/postgres | |
| run: | | |
| cargo install sqlx-cli --no-default-features --features native-tls,postgres | |
| sqlx migrate run | |
| - name: Build backend | |
| env: | |
| DATABASE_URL: postgresql://postgres:password@localhost:5432/postgres | |
| run: cargo build --release --target aarch64-unknown-linux-gnu | |
| - name: Add cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-all-crates: true | |
| - name: Zip frontend and backend | |
| run: | | |
| zip -r release.zip frontend/dist target/aarch64-unknown-linux-gnu/release/vault | |
| - name: Upload release asset | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ./release.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # - name: Upload release asset | |
| # uses: actions/upload-release-asset@v1 | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # with: | |
| # upload_url: ${{ github.event.release.upload_url }} | |
| # asset_path: ./release.zip | |
| # asset_name: release.zip | |
| # asset_content_type: application/zip |