ci: use espressif/idf:v5.5 container image
Some checks failed
ESP32 Build & Release / build (push) Failing after 2s
Some checks failed
ESP32 Build & Release / build (push) Failing after 2s
This commit is contained in:
@@ -13,15 +13,20 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Checkout
|
# Checkout (Native Git - No Node.js required)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Configure Git Safe Directory
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE" || true
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
SERVER_HOST=$(echo "${{ github.server_url }}" | sed -e 's|^https://||' -e 's|^http://||')
|
||||||
|
git init
|
||||||
|
git remote add origin "https://${GITEA_TOKEN}@${SERVER_HOST}/${{ github.repository }}.git" || \
|
||||||
|
git remote set-url origin "https://${GITEA_TOKEN}@${SERVER_HOST}/${{ github.repository }}.git"
|
||||||
|
git fetch --depth 1 origin "${{ github.sha }}" || git fetch --depth 1 origin main
|
||||||
|
git checkout -f FETCH_HEAD
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Build firmware & merged binary
|
# Build firmware & merged binary
|
||||||
@@ -35,9 +40,6 @@ jobs:
|
|||||||
idf.py build
|
idf.py build
|
||||||
idf.py merge-bin
|
idf.py merge-bin
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Prepare release artifacts
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Prepare release artifacts & calculate hashes
|
# Prepare release artifacts & calculate hashes
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@@ -81,7 +83,7 @@ jobs:
|
|||||||
ls -lh release/
|
ls -lh release/
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Delete existing "latest" release
|
# Delete existing "latest" release & tag
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
- name: Delete existing latest release
|
- name: Delete existing latest release
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -106,20 +108,16 @@ jobs:
|
|||||||
|| true
|
|| true
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Create latest release
|
# Create latest release and upload assets (Native API & Curl)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
- name: Create latest release
|
- name: Create latest release
|
||||||
uses: akkuman/gitea-release-action@v1
|
shell: bash
|
||||||
with:
|
env:
|
||||||
server_url: ${{ github.server_url }}
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
repository: ${{ github.repository }}
|
run: |
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||||
|
|
||||||
tag_name: latest
|
export RELEASE_BODY="Automatically built from the \`main\` branch.
|
||||||
name: "Latest ESP32 Firmware"
|
|
||||||
|
|
||||||
body: |
|
|
||||||
Automatically built from the `main` branch.
|
|
||||||
|
|
||||||
Commit:
|
Commit:
|
||||||
${{ github.sha }}
|
${{ github.sha }}
|
||||||
@@ -136,7 +134,35 @@ jobs:
|
|||||||
Target:
|
Target:
|
||||||
ESP32
|
ESP32
|
||||||
|
|
||||||
This release is automatically replaced on every push to `main`.
|
This release is automatically replaced on every push to \`main\`."
|
||||||
|
|
||||||
files: |
|
REL_ID=$(python3 -c "import urllib.request, json, os
|
||||||
release/*
|
api = '${API}'
|
||||||
|
token = os.environ['GITEA_TOKEN']
|
||||||
|
headers = {'Authorization': f'token {token}', 'Content-Type': 'application/json'}
|
||||||
|
payload = {
|
||||||
|
'tag_name': 'latest',
|
||||||
|
'target_commitish': 'main',
|
||||||
|
'name': 'Latest ESP32 Firmware',
|
||||||
|
'body': os.environ.get('RELEASE_BODY', ''),
|
||||||
|
'draft': False,
|
||||||
|
'prerelease': False
|
||||||
|
}
|
||||||
|
req = urllib.request.Request(f'{api}/releases', data=json.dumps(payload).encode('utf-8'), headers=headers, method='POST')
|
||||||
|
with urllib.request.urlopen(req) as resp:
|
||||||
|
print(json.loads(resp.read().decode('utf-8'))['id'])
|
||||||
|
")
|
||||||
|
|
||||||
|
echo "Created release ID: ${REL_ID}"
|
||||||
|
|
||||||
|
for fpath in release/*; do
|
||||||
|
[ -f "$fpath" ] || continue
|
||||||
|
echo "Uploading $fpath..."
|
||||||
|
curl -fsSL \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-F "attachment=@${fpath}" \
|
||||||
|
"${API}/releases/${REL_ID}/assets"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Release created and all assets uploaded successfully!"
|
||||||
|
|||||||
Reference in New Issue
Block a user