Skip to content

Commit

Permalink
Add actions to automatically relase bazelci_rules (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
coeuvre authored Sep 27, 2021
1 parent 7add245 commit e036957
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/release-rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: release-rules
on:
push:
tags:
- "rules-[0-9]+.[0-9]+.[0-9]+"
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
rules_version: ${{ env.RULES_VERSION }}
steps:
- name: Get the release version from the tag
shell: bash
if: env.RULES_VERSION == ''
run: |
echo "RULES_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RULES_VERSION }}"
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RULES_VERSION }}
release_name: ${{ env.RULES_VERSION }}

build-release:
name: build-release
needs: ['create-release']
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Build release asset
shell: bash
run: |
staging="bazelci_${{ needs.create-release.outputs.rules_version }}"
cp -r rules "$staging"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
- name: Upload release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream

0 comments on commit e036957

Please sign in to comment.