Skip to content

Commit

Permalink
create pre-release for main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightXiaoHan committed Sep 14, 2023
1 parent b8f0c4a commit e2897da
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- release*
- main
tags:
- v*
pull_request:
Expand Down Expand Up @@ -96,10 +97,11 @@ jobs:
needs:
- run-x86_64
- run-arm64
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') || github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- name: Create Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
id: create_release
uses: actions/create-release@v1
with:
Expand All @@ -110,6 +112,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Pre-Release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
id: create_pre_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Pre-Release
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v3
with:
name: home-cli-pack-x86_64
Expand All @@ -120,7 +134,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./home-cli-x86_64.tar
asset_name: home-cli-x86_64.tar
asset_content_type: application/tar

- name: Upload Pre-Release Assets x86_64
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./home-cli-x86_64.tar
asset_name: home-cli-x86_64.tar
asset_content_type: application/tar
Expand All @@ -135,7 +160,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./home-cli-arm64.tar
asset_name: home-cli-arm64.tar
asset_content_type: application/tar

- name: Upload Pre-Release Assets arm64
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./home-cli-arm64.tar
asset_name: home-cli-arm64.tar
asset_content_type: application/tar

0 comments on commit e2897da

Please sign in to comment.