scratch that going back to previous approach but with github and dockerhub auth
This commit is contained in:
+16
-43
@@ -11,50 +11,30 @@ jobs:
|
||||
name: Test and Lint Code
|
||||
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:
|
||||
- name: 1. Install System Dependencies
|
||||
run: |
|
||||
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: 1. Checkout Repository Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 2. Install Lua Dependencies
|
||||
run: |
|
||||
echo "Installing Lua scripture..."
|
||||
luarocks-5.1 install busted
|
||||
# Note: The checkout step will happen after this, so file copying must happen later.
|
||||
echo "Sanctifying runner with Lua tools..."
|
||||
# Use apt-get for the Ubuntu-based runner environment
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y lua5.1 luarocks luacheck
|
||||
sudo luarocks install busted
|
||||
|
||||
- name: 3. Authenticate to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 4. Checkout Repository Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Use the PAT for checking out the repository code itself
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
|
||||
- name: 5. Run Luacheck Scrutiny
|
||||
- name: 3. Run Luacheck Scrutiny
|
||||
run: |
|
||||
echo "Scanning Lua scripture..."
|
||||
luacheck --std lua51 .
|
||||
|
||||
- name: 6. Perform Unit Inquisition (Busted)
|
||||
- name: 4. Perform Unit Inquisition (Busted)
|
||||
run: |
|
||||
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/
|
||||
busted --lua=lua5.1 --verbose spec/
|
||||
|
||||
# The deploy job remains the same, but also benefits from authentication
|
||||
deploy-to-device:
|
||||
name: Deploy to Roof Unit
|
||||
needs: test-and-lint
|
||||
@@ -62,35 +42,28 @@ jobs:
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
|
||||
steps:
|
||||
- name: 1. Authenticate to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 2. Checkout Repository Code
|
||||
- name: 1. Checkout Repository Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
|
||||
- name: 3. Prepare SSH Environment
|
||||
# ... this part remains exactly the same as the previous version ...
|
||||
- name: 2. Prepare SSH Environment
|
||||
run: |
|
||||
echo "Preparing the sacred keys and crypto-litany for SSH communion..."
|
||||
mkdir -p ~/.ssh/
|
||||
echo "${{ secrets.ROOF_UNIT_SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
ssh-keyscan -H "${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/known_hosts
|
||||
|
||||
echo "Host roof-unit" > ~/.ssh/config
|
||||
echo " HostName ${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/config
|
||||
echo " User ${{ secrets.ROOF_UNIT_USER }}" >> ~/.ssh/config
|
||||
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.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 " PubkeyAcceptedAlgorithms +ssh-rsa" >> ~/.ssh/config
|
||||
|
||||
- name: 4. Execute Deployment Ritual
|
||||
- name: 3. Execute Deployment Ritual
|
||||
run: |
|
||||
echo "Initiating deployment sequence..."
|
||||
chmod +x ./skyweave_deploy.sh
|
||||
|
||||
Reference in New Issue
Block a user