scratch that going back to previous approach but with github and dockerhub auth
This commit is contained in:
+17
-44
@@ -10,51 +10,31 @@ jobs:
|
|||||||
test-and-lint:
|
test-and-lint:
|
||||||
name: Test and Lint Code
|
name: Test and Lint Code
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# This container definition is more specific and includes all tools from the start.
|
|
||||||
container:
|
|
||||||
image: alpine:latest # A clean, basic image
|
|
||||||
# Pass the GitHub PAT to the container so it can clone actions
|
|
||||||
options: --env GITEA_PAT=${{ secrets.GH_PAT }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 1. Install System Dependencies
|
- name: 1. Checkout Repository Code
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
echo "Sanctifying container with all necessary tools..."
|
|
||||||
# Install everything needed for the entire job at the beginning
|
|
||||||
apk add --no-cache git curl nodejs-current lua5.1-dev build-base luacheck luarocks
|
|
||||||
|
|
||||||
- name: 2. Install Lua Dependencies
|
- name: 2. Install Lua Dependencies
|
||||||
run: |
|
run: |
|
||||||
echo "Installing Lua scripture..."
|
echo "Sanctifying runner with Lua tools..."
|
||||||
luarocks-5.1 install busted
|
# Use apt-get for the Ubuntu-based runner environment
|
||||||
# Note: The checkout step will happen after this, so file copying must happen later.
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lua5.1 luarocks luacheck
|
||||||
- name: 3. Authenticate to Docker Hub
|
sudo luarocks install busted
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: 4. Checkout Repository Code
|
- name: 3. Run Luacheck Scrutiny
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
# Use the PAT for checking out the repository code itself
|
|
||||||
token: ${{ secrets.GH_PAT }}
|
|
||||||
|
|
||||||
- name: 5. Run Luacheck Scrutiny
|
|
||||||
run: |
|
run: |
|
||||||
echo "Scanning Lua scripture..."
|
echo "Scanning Lua scripture..."
|
||||||
luacheck --std lua51 .
|
luacheck --std lua51 .
|
||||||
|
|
||||||
- name: 6. Perform Unit Inquisition (Busted)
|
- name: 4. Perform Unit Inquisition (Busted)
|
||||||
run: |
|
run: |
|
||||||
echo "Initiating unit tests..."
|
echo "Initiating unit tests..."
|
||||||
# Copy the library needed for testing right before the test runs
|
# The workspace is already checked out, so we can copy the file directly.
|
||||||
cp lib/json.lua skyweave/
|
cp lib/json.lua skyweave/
|
||||||
busted --lua=lua5.1 --verbose spec/
|
busted --lua=lua5.1 --verbose spec/
|
||||||
|
|
||||||
# The deploy job remains the same, but also benefits from authentication
|
|
||||||
deploy-to-device:
|
deploy-to-device:
|
||||||
name: Deploy to Roof Unit
|
name: Deploy to Roof Unit
|
||||||
needs: test-and-lint
|
needs: test-and-lint
|
||||||
@@ -62,35 +42,28 @@ jobs:
|
|||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 1. Authenticate to Docker Hub
|
- name: 1. Checkout Repository Code
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: 2. Checkout Repository Code
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
token: ${{ secrets.GH_PAT }}
|
|
||||||
|
|
||||||
- name: 3. Prepare SSH Environment
|
- name: 2. Prepare SSH Environment
|
||||||
# ... this part remains exactly the same as the previous version ...
|
|
||||||
run: |
|
run: |
|
||||||
echo "Preparing the sacred keys and crypto-litany for SSH communion..."
|
echo "Preparing the sacred keys and crypto-litany for SSH communion..."
|
||||||
mkdir -p ~/.ssh/
|
mkdir -p ~/.ssh/
|
||||||
echo "${{ secrets.ROOF_UNIT_SSH_KEY }}" > ~/.ssh/id_rsa
|
echo "${{ secrets.ROOF_UNIT_SSH_KEY }}" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
ssh-keyscan -H "${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/known_hosts
|
ssh-keyscan -H "${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
echo "Host roof-unit" > ~/.ssh/config
|
echo "Host roof-unit" > ~/.ssh/config
|
||||||
echo " HostName ${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/config
|
echo " HostName ${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/config
|
||||||
echo " User ${{ secrets.ROOF_UNIT_USER }}" >> ~/.ssh/config
|
echo " User ${{ secrets.ROOF_UNIT_USER }}" >> ~/.ssh/config
|
||||||
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
|
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
|
||||||
echo " KexAlgorithms +diffie-hellman-group1-sha1" >> ~/.ssh/config
|
echo " KexAlgorithms +diffie-hellman-group1-sha1" >> ~/.ssh/config
|
||||||
echo " HostKeyAlgorithms +ssh-rsa" >> ~/.ssh/gitea/runners/gitea-runner-1/config
|
echo " HostKeyAlgorithms +ssh-rsa" >> ~/.ssh/config
|
||||||
echo " MACs +hmac-sha1" >> ~/.ssh/config
|
echo " MACs +hmac-sha1" >> ~/.ssh/config
|
||||||
echo " PubkeyAcceptedAlgorithms +ssh-rsa" >> ~/.ssh/config
|
echo " PubkeyAcceptedAlgorithms +ssh-rsa" >> ~/.ssh/config
|
||||||
|
|
||||||
- name: 4. Execute Deployment Ritual
|
- name: 3. Execute Deployment Ritual
|
||||||
run: |
|
run: |
|
||||||
echo "Initiating deployment sequence..."
|
echo "Initiating deployment sequence..."
|
||||||
chmod +x ./skyweave_deploy.sh
|
chmod +x ./skyweave_deploy.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user