Skip to content

Commit

Permalink
Change: Break Down GitHub Actions Jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen Cong Cuong committed Mar 23, 2024
1 parent bd5ecec commit dbd31e2
Showing 1 changed file with 40 additions and 9 deletions.
49 changes: 40 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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

0 comments on commit dbd31e2

Please # to comment.