Skip to content

Commit

Permalink
Package what this repo does in GH Action + add tests for it
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyCat committed Aug 29, 2024
1 parent 75cc557 commit 3add3ce
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches:
- master
jobs:
test:
test_local:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -21,3 +21,20 @@ jobs:
run: ./test-generate-gpg
- name: Run tests
run: ./docker-test-all
test_as_action:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download test packages
run: ./test-download-debs
- name: Generate test GPG keys
run: ./test-generate-gpg
- name: Run action - create repo from scratch
uses: ./ # Uses an action in the root directory
id: az_repo_apt_add
with:
az_storage_sas_token: ${{ secrets.TEST_AZURE_STORAGE_SAS_TOKEN }}
az_storage_account: packageskaitai
az_storage_container: test3
packages: all_pkgs/kaitai-struct-compiler_0.7_all.deb
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Central Dockerfile for GitHub Action invoking `az-repo-apt-add`

# Use Ubuntu 24.04 as base image - it's simpler to start off Debian-based OS,
# given that we'll be using `dpkg-scanpackages`
FROM ubuntu:24.04

# Install Ubuntu native prerequisites
RUN \
apt-get update && \
apt-get install -y \
dpkg-dev \
ca-certificates \
curl \
apt-transport-https \
lsb-release \
gnupg

# Install Azure CLI
RUN \
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/azure-cli.list && \
apt-get update && \
apt-get install azure-cli

COPY \
az-repo-apt-add \
repo-apt-handle \
common.sh \
./

# Ensures that Action maps all the paths in invoking workspace, e.g.
# paths to .deb files to publish
WORKDIR /github/workspace

ENTRYPOINT ["/az-repo-apt-add"]
23 changes: 23 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish .deb package
description: Add .deb package to apt repository hosted on Azure Blob Storage
inputs:
az_storage_sas_token:
description: Azure Storage SAS token
required: true
az_storage_account:
description: Azure Storage account name
required: true
az_storage_container:
description: Azure Storage container name
required: true
packages:
description: List of paths to .deb packages to publish
required: true
runs:
using: docker
image: Dockerfile
env:
AZURE_STORAGE_SAS_TOKEN: ${{ inputs.az_storage_sas_token }}
AZ_STORAGE_ACCOUNT: ${{ inputs.az_storage_account }}
AZ_STORAGE_CONTAINER: ${{ inputs.az_storage_container }}
PKGS_SRC: ${{ inputs.packages }}

0 comments on commit 3add3ce

Please sign in to comment.