Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow for continuous delivery #569

Merged
merged 4 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
33 changes: 30 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ non-Fortran related package manager.
### Setting up fpm

#### Binary download
`x86-64` binaries are available [to download](https://github.com/fortran-lang/fpm/releases) for Windows, MacOS and Linux.

Binaries for the latest stable release are available [to download](https://github.com/fortran-lang/fpm/releases/latest) for Windows, MacOS, and Linux.

__Note:__ On Linux and MacOS, you will need to enable executable permission before you can use the binary.

_e.g._ `$ chmod u+x fpm-0.4.0-linux-x86_64`

The binaries at the [current tag](https://github.com/fortran-lang/fpm/releases/tag/current) are updated automatically to always provide the current git version from the default branch.


#### [Conda]

Expand Down Expand Up @@ -147,7 +150,7 @@ To build manually using the single source distribution, run the following code (

```
mkdir _tmp
curl -LJ https://github.com/fortran-lang/fpm/releases/download/v0.4.0/fpm-0.4.0.F90 > _tmp/fpm.F90
curl -LJ https://github.com/fortran-lang/fpm/releases/download/current/fpm.F90 > _tmp/fpm.F90
gfortran -J _tmp _tmp/fpm.F90 -o _tmp/fpm
_tmp/fpm install --flag "-g -fbacktrace -O3"
rm -r _tmp
Expand Down