From 6fb6cc27c10e1e148a850e010bf20d83950df1b2 Mon Sep 17 00:00:00 2001 From: Lessley Dennington Date: Wed, 2 Jun 2021 14:46:05 -0700 Subject: [PATCH] Add apt-get release workflow --- .github/configure_repoclient.py | 5 ++-- .github/workflows/release-apt-get.yml | 43 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release-apt-get.yml diff --git a/.github/configure_repoclient.py b/.github/configure_repoclient.py index 6d9418a34439fd..daba466a896c76 100644 --- a/.github/configure_repoclient.py +++ b/.github/configure_repoclient.py @@ -6,10 +6,9 @@ def check_var(name:str) -> bool: print(f"Required env var {name} is missing!") exit(1) -for var in ['APT_REPO_ID', 'AZURE_AAD_ID', 'AAD_CLIENT_SECRET']: +for var in ['AZURE_AAD_ID', 'AAD_CLIENT_SECRET']: check_var(var) -repo_id = env['APT_REPO_ID'] aad_id = env['AZURE_AAD_ID'] password = env['AAD_CLIENT_SECRET'] @@ -20,9 +19,9 @@ def check_var(name:str) -> bool: "server": "azure-apt-cat.cloudapp.net", "port": "443", - "repositoryId": repo_id, "AADClientId": aad_id, "AADClientSecret": password, + "repositoryId": "" } configs = [ diff --git a/.github/workflows/release-apt-get.yml b/.github/workflows/release-apt-get.yml new file mode 100644 index 00000000000000..832ca09dddff66 --- /dev/null +++ b/.github/workflows/release-apt-get.yml @@ -0,0 +1,43 @@ +name: "release-apt-get" +on: [push] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: 'Download Repo Client' + env: + AZ_SUB: ${{ secrets.AZURE_SUBSCRIPTION }} + run: | + az storage blob download --subscription "$AZ_SUB" --account-name gitcitoolstore -c tools -n azure-repoapi-client_2.0.1_amd64.deb -f repoclient.deb --auth-mode login + - name: "Install Repo Client" + env: + AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }} + AAD_CLIENT_SECRET: ${{ secrets.AAD_CLIENT_SECRET }} + run: | + sudo apt-get install python3-adal --yes + sudo dpkg -i repoclient.deb + python .github/configure_repoclient.py + rm repoclient.deb + - name: "Publish to apt feed" + env: + RELEASE: ${{ github.event.inputs.release }} + run: | + pip install requests + python .github/fetch_release.py + wget "$(cat asset_url.txt)" + for id in ${{ secrets.BIONIC_REPO_ID }} ${{ secrets.HIRSUTE_REPO_ID }} + do + repoclient -v v3 -c config.json package add --check --wait 300 "$(cat asset_name.txt)" -r $id + done \ No newline at end of file