diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e68d17a..a525801 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,11 @@ # This is a basic workflow to help you get started with Actions -name: Deploy Azure Function +name: Deploy Rust App to Azure Function on: - workflow_dispatch: + push: + branches: + - master env: AZURE_FUNCTIONAPP_NAME: fn-rust-pdf-generator # set this to your application's name, it has to be unique @@ -14,8 +16,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: 'Checkout GitHub action' - uses: actions/checkout@v2 + - name: "Checkout GitHub action" + uses: actions/checkout@v4 - name: Install with RustUp shell: bash @@ -36,14 +38,41 @@ jobs: shell: bash run: cp target/x86_64-unknown-linux-musl/release/handler . + - name: 'Tar files' + run: tar -cvf azf-rust-pdf.tar ./ + + - name: Store build artifact + uses: actions/upload-artifact@v4 + with: + name: azf-rust-pdf + path: azf-rust-pdf.tar + retention-days: 7, + compression-level: 9, + 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' - + 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: | @@ -57,4 +86,6 @@ jobs: - name: Deploy to Azure Functions shell: bash - run: func azure functionapp publish ${{ env.AZURE_FUNCTIONAPP_NAME }} --custom + run: | + cd azf-rust-pdf + func azure functionapp publish ${{ env.AZURE_FUNCTIONAPP_NAME }} --custom \ No newline at end of file