diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-11-02 16:21:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 16:21:31 +0100 |
commit | a460e2760a4e33f086c9e1669b08e53885bdc197 (patch) | |
tree | 83fb8f0135d398a20a1cfea74d8dc43e77ee9bd4 /.github/workflows | |
parent | 02fdf8dde8877cf2ac738fed8d20561da16cec1f (diff) | |
download | fpm-a460e2760a4e33f086c9e1669b08e53885bdc197.tar.gz fpm-a460e2760a4e33f086c9e1669b08e53885bdc197.zip |
Add workflow for continuous delivery (#569)
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/CI.yml | 33 | ||||
-rw-r--r-- | .github/workflows/release.yml | 33 |
2 files changed, 60 insertions, 6 deletions
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b2d5aef..bc36835 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -167,17 +167,38 @@ jobs: path: ${{ env.FPM_RELEASE }} upload-artifacts: - if: github.event_name == 'release' + if: ${{ github.event_name == 'release' && contains(github.ref, 'v') || github.event_name == 'push' }} runs-on: ubuntu-latest needs: - build steps: + - id: deploy-on-push + if: ${{ github.event_name == 'push' }} + run: + echo "::set-output name=result::${{ env.DEPLOY_BRANCH }}" + env: + DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH && contains(github.ref, secrets.DEPLOY_BRANCH) && 1 || 0 }} + + - uses: actions/checkout@v2 + if: ${{ github.event_name == 'push' }} + - name: Download Artifacts uses: actions/download-artifact@v2 with: path: ${{ github.workspace }} # This will download all files + - name: Normalize file names for continuous delivery + if: ${{ github.event_name == 'push' }} + run: | + for output in fpm-*/fpm-*; do + pushd $(dirname "$output") + mv -v $(basename $output) $(basename $output | sed -E '${{ env.replace }}') + popd + done + env: + replace: 's/-([0-9]+\.[0-9]+\.[0-9]+-[0-9]+-g)?[0-9a-f]+//' + - name: Create SHA256 checksums run: | for output in fpm-*/fpm-*; do @@ -186,12 +207,18 @@ jobs: popd done + - name: Move/Create continuous tag + if: ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }} + run: | + git tag --force 'current' ${{ github.sha }} + git push --tags --force + - name: Upload assets - if: github.event_name == 'release' uses: svenstaro/upload-release-action@v2 + if: ${{ github.event_name == 'release' || steps.deploy-on-push.outputs.result != 0 }} with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fpm-*/fpm-* file_glob: true - tag: ${{ github.ref }} + tag: ${{ github.event_name == 'release' && github.ref || 'current'}} overwrite: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3c5259..37df665 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,18 +98,39 @@ jobs: path: ${{ env.OUTPUT }} upload-artifacts: - if: github.event_name == 'release' + if: ${{ github.event_name == 'release' && contains(github.ref, 'v') || github.event_name == 'push' }} runs-on: ubuntu-latest needs: - source-archive - source-single-file steps: + - id: deploy-on-push + if: ${{ github.event_name == 'push' }} + run: + echo "::set-output name=result::${{ env.DEPLOY_BRANCH }}" + env: + DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH && contains(github.ref, secrets.DEPLOY_BRANCH) && 1 || 0 }} + + - uses: actions/checkout@v2 + if: ${{ github.event_name == 'push' }} + - name: Download Artifacts uses: actions/download-artifact@v2 with: path: ${{ github.workspace }} # This will download all files + - name: Normalize file names for continuous delivery + if: ${{ github.event_name == 'push' }} + run: | + for output in fpm-*/fpm-*; do + pushd $(dirname "$output") + mv -v $(basename $output) $(basename $output | sed -E '${{ env.replace }}') + popd + done + env: + replace: 's/-([0-9]+\.[0-9]+\.[0-9]+-[0-9]+-g)?[0-9a-f]+//' + - name: Create SHA256 checksums run: | for output in fpm-*/fpm-*; do @@ -118,12 +139,18 @@ jobs: popd done + - name: Move/Create continuous tag + if: ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }} + run: | + git tag --force 'current' ${{ github.sha }} + git push --tags --force + - name: Upload assets - if: ${{ github.event_name == 'release' }} + if: ${{ github.event_name == 'release' || steps.deploy-on-push.outputs.result != 0 }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fpm-*/fpm-* file_glob: true - tag: ${{ github.ref }} + tag: ${{ github.event_name == 'release' && github.ref || 'current'}} overwrite: true |