Skip to content

update readme

update readme #182

on:
push:
branches: ['**']
tags: ['**']
release:
types: [published]
jobs:
mirror:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- name: Checkout (full history)
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Mirror to GitLab
env:
GITLAB_URL: ${{ secrets.GITLAB_URL }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
git remote add gitlab "https://oauth2:${GITLAB_TOKEN}@${GITLAB_URL#https://}"
git push gitlab --all --force
git push gitlab --tags --force
mirror-release:
runs-on: ubuntu-latest
if: github.event_name == 'release'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- name: Mirror Release to GitLab
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_RELEASETOKEN }}
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: ${{ github.event.release.name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_BODY: ${{ github.event.release.body }}
RELEASE_DATE: ${{ github.event.release.published_at }}
run: |
# Release in GitLab erstellen
jq -n \
--arg name "$RELEASE_NAME" \
--arg tag "$RELEASE_TAG" \
--arg desc "$RELEASE_BODY" \
--arg date "$RELEASE_DATE" \
'{name: $name, tag_name: $tag, description: $desc, released_at: $date}' \
| curl --fail -X POST \
"https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/releases" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
--header "Content-Type: application/json" \
--data @-
# Assets (APKs etc.) runterladen und zu GitLab hochladen
gh release download "$RELEASE_TAG" --dir ./assets
for file in ./assets/*; do
filename=$(basename "$file")
# Asset zu GitLab Package Registry hochladen
curl --fail -X PUT \
"https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/packages/generic/${RELEASE_TAG}/1.0.0/${filename}" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
--upload-file "$file"
# Asset mit Release verknüpfen
jq -n \
--arg name "$filename" \
--arg url "https://gitlab.com/jamakr4/mg4-360-camera-app/-/package_files/generic/${RELEASE_TAG}/1.0.0/${filename}" \
'{name: $name, url: $url}' \
| curl --fail -X POST \
"https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/releases/${RELEASE_TAG}/assets/links" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
--header "Content-Type: application/json" \
--data @-
done