Skip to content

Change: Break Down GitHub Actions Jobs #10

Change: Break Down GitHub Actions Jobs

Change: Break Down GitHub Actions Jobs #10

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Deploy Rust App to Azure Function
on:
env:
AZURE_FUNCTIONAPP_NAME: fn-rust-pdf-generator # set this to your application's name, it has to be unique
AZURE_GROUP_NAME: fnrustpdfgenerator
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub action"
uses: actions/checkout@v4
- name: Install with RustUp
shell: bash
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Install musl
run: sudo apt-get install -y --no-install-recommends musl-tools
- name: Add Linux MUSL Target
shell: bash
run: rustup target add x86_64-unknown-linux-musl
- name: Build release
shell: bash
run: cargo build --release --target=x86_64-unknown-linux-musl
- name: Copy handler to parent directory
shell: bash
run: cp target/x86_64-unknown-linux-musl/release/handler .
- name: 'Tar files'
run: tar -cvf my_files.tar ./
- name: Store build artifact
uses: actions/upload-artifact@v4
with:
name: azf-rust-pdf
path: my_files.tar
retention-days: 7,
compression-level: 6,
overwrite: false
deploy:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: "Checkout Github Actions"
uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: azf-rust-pdf
- name: Display structure of downloaded files
run: ls -R
# See https://github.com/Azure/azure-functions-core-tools#linux
- name: Setup the repository
shell: bash
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
- name: Install Azure Core Tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install azure-functions-core-tools-4
- name: Azure Login
uses: azure/#@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Functions
shell: bash
run: |
cd fn-rust-pdf
func azure functionapp publish ${{ env.AZURE_FUNCTIONAPP_NAME }} --custom