automate release and sync
This commit is contained in:
92
.github/workflows/letro-release.yml
vendored
Normal file
92
.github/workflows/letro-release.yml
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
name: Letro Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "release/letro-v*.*.*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: |
|
||||
# Extract version from tag (release/letro-v1.2.3 -> letro-v1.2.3)
|
||||
TAG_NAME=${GITHUB_REF#refs/tags/release/}
|
||||
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
|
||||
echo "Version: $TAG_NAME"
|
||||
|
||||
- name: Generate SBOM with Trivy
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
format: 'cyclonedx'
|
||||
output: 'sbom.json'
|
||||
|
||||
- name: Get current timestamp
|
||||
id: timestamp
|
||||
run: echo "date=$(date -u +'%Y-%m-%d %H:%M')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create GitHub Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: ${{ steps.version.outputs.tag_name }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
body: |
|
||||
This release has been automatically published from the internal repository.
|
||||
|
||||
**Version:** ${{ steps.version.outputs.tag_name }}
|
||||
**Published:** ${{ steps.timestamp.outputs.date }} UTC
|
||||
|
||||
> This is an official release. For questions or support, please contact the maintainers.
|
||||
|
||||
- name: Upload SBOM to Release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./sbom.json
|
||||
asset_name: sbom.json
|
||||
asset_content_type: application/json
|
||||
|
||||
- name: Upload FORK_DIVERGENCE to Release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./FORK_DIVERGENCE.md
|
||||
asset_name: FORK_DIVERGENCE.md
|
||||
asset_content_type: text/markdown
|
||||
|
||||
- name: Trigger sync to public repository
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.LETRO_WORKFLOW_BOT }}
|
||||
script: |
|
||||
await github.rest.actions.createWorkflowDispatch({
|
||||
owner: 'p-num',
|
||||
repo: 'letro-public-sync',
|
||||
workflow_id: 'sync-element-x-ios.yml',
|
||||
ref: 'main',
|
||||
inputs: {
|
||||
version: '${{ steps.version.outputs.tag_name }}'
|
||||
}
|
||||
});
|
||||
console.log('Triggered sync workflow for version ${{ steps.version.outputs.tag_name }}');
|
||||
Reference in New Issue
Block a user