Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alefnode committed Apr 2, 2022
1 parent dce4073 commit 9906048
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: opensuse images release

on:
workflow_dispatch:
push:
tags:
- '**'
schedule:
- cron: "59 23 * * *"

jobs:
once:
runs-on: ubuntu-20.04
name: Create GitHub release
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}${{ steps.create_nightly.outputs.upload_url }}

steps:
- name: Create Release
id: create_release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

- uses: dev-drprasad/delete-tag-and-release@v0.1.3
if: startsWith(github.ref, 'refs/tags/v') != true
with:
delete_release: true # default: false
tag_name: nightly # tag name to delete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Tag snapshot
if: startsWith(github.ref, 'refs/tags/v') != true
uses: tvdias/github-tagger@v0.0.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: nightly

- name: Create Release
id: create_nightly
if: startsWith(github.ref, 'refs/tags/v') != true
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
release_name: nightly
draft: false
prerelease: true

build:
runs-on: ubuntu-20.04
needs: once

steps:
- name: Get current date
run: echo "current_date=$(date +'%Y%m%d')" >> $GITHUB_ENV

- name: Set suffix
run: echo "release_suffix=_${{ env.current_date }}" >> $GITHUB_ENV

- name: Set nightly version
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo "version=nightly" >> $GITHUB_ENV

- name: Set version
if: startsWith(github.ref, 'refs/tags/v') == true
run: echo "version=$(echo ${{ github.ref }} | rev | cut -d'/' -f1 | rev)" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v2

- name: Create build dir
run: mkdir -p /tmp/build-results

- name: Download official rootfs
run: wget -P data/ https://download.opensuse.org/repositories/home:/alefnode:/GSI-Phone/images/openSUSE-Tumbleweed-ARM-PHOSH.aarch64-gsi-volla-yggdrasil.aarch64.tar.xz

- name: Create ZIP file to flash with Recovery
run: zip -r /tmp/build-results/openSUSE-Tumbleweed-ARM-PHOSH.aarch64-gsi-volla-yggdrasil.aarch64-${{ env.release_suffix }}.zip *

- name: Upload Rootfs image
id: upload-rootfs
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.once.outputs.upload_url }}
asset_path: /tmp/build-results/openSUSE-Tumbleweed-ARM-PHOSH.aarch64-gsi-volla-yggdrasil.aarch64-${{ env.release_suffix }}.zip
asset_name: openSUSE-Tumbleweed-ARM-PHOSH.aarch64-gsi-volla-yggdrasil.aarch64-${{ env.release_suffix }}.zip
asset_content_type: application/gzip
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.xz
*.xz
*.zip

0 comments on commit 9906048

Please sign in to comment.