aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: ecdcd06ba67a96b073620df1ff0f2f1345041327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Create Release

on:
  push:
    tags:
      - 'v*' # This triggers the workflow on version tags

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Clone dotfiles repository
        run: git clone --bare https://github.com/srdusr/dotfiles.git $HOME/temp-dotfiles

      - name: Create zip file
        run: |
          cd $HOME/temp-dotfiles
          git archive --format=zip --output=$HOME/dotfiles.zip HEAD

      - name: Clean up temporary clone
        run: rm -rf $HOME/temp-dotfiles

      - name: Create GitHub Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: Automatically generated release
          draft: false
          prerelease: false

      - name: Upload zip 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: $HOME/dotfiles.zip
          asset_name: dotfiles.zip
          asset_content_type: application/zip